Re: [PATCH v4 2/9] dmapool: remove checks for dev == NULL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 11/12/18 11:32 AM, John Garry wrote:
> On 12/11/2018 15:42, Tony Battersby wrote:
>> dmapool originally tried to support pools without a device because
>> dma_alloc_coherent() supports allocations without a device.  But nobody
>> ended up using dma pools without a device, so the current checks in
>> dmapool.c for pool->dev == NULL are both insufficient and causing bloat.
>> Remove them.
>>
> As an aside, is it right that dma_pool_create() does not actually reject 
> dev==NULL and would crash from a NULL-pointer dereference?
>
> Thanks,
> John
>
When passed a NULL dev, dma_pool_create() will already crash with a
NULL-pointer dereference before this patch series, because it checks for
dev == NULL in some places but not others.  Specifically, it will crash
in one of these two places in dma_pool_create():

	retval = kmalloc_node(sizeof(*retval), GFP_KERNEL, dev_to_node(dev));
-or-
	if (list_empty(&dev->dma_pools))

So removing the checks for dev == NULL will not make previously-working
code to start crashing suddenly.  And since passing dev == NULL would be
an API misuse error and not a runtime error, I would rather not add a
new check to reject it.

Tony




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux