lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 20 May 2014 08:54:09 +0300
From:	Eli Billauer <eli.billauer@...il.com>
To:	Tejun Heo <tj@...nel.org>
Cc:	gregkh@...uxfoundation.org, devel@...verdev.osuosl.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/5] dma-mapping: Add devm_ interface for dma_map_single()

Hello, Tejun.

On 19/05/14 23:17, Tejun Heo wrote:
>
> What can't it just do the following?
>
> 	if (dma_mapping_error(dev, dma_handle)) {
> 		devres_free(dr);
> 		return dma_handle;
> 	}
>
> The caller would have to invoke dma_mapping_error() again but is that
> a problem?
>    
That seems OK to me, but the problem I'm concerned with is this: In 
devm_get_free_pages() it says

     devres = devres_alloc(devm_pages_release,
                   sizeof(struct pages_devres), GFP_KERNEL);
     if (unlikely(!devres)) {
         free_pages(addr, order);
         return 0;
     }

What should I put instead of this "return 0" to conform with the current 
API?

And to make things even worse, on some architectures, 
dma_mapping_error() always returns success, regardless of dma_handle. So 
if we stick to the current API, the caller of devm_get_free_pages() will 
never know it failed on these architectures.

So my conclusion was that the caller must be aware that if 
devm_get_free_pages() returns zero it's an error, regardless of 
dma_mapping_error(). That breaks the API. Once it's broken, why not 
return zero on all possible errors?

Maybe I didn't understand what you suggested.

Regards,
    Eli


> Thanks.
>
>    


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ