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]
Message-ID: <CA+V-a8vN2VBCjuAMGootU=t+PbjK7wVDQeYZgV03Wa5070WwFw@mail.gmail.com>
Date:	Thu, 23 Jan 2014 15:51:31 +0530
From:	Prabhakar Lad <prabhakar.csengg@...il.com>
To:	Sachin Kamat <sachin.kamat@...aro.org>
Cc:	Andrew Morton <akpm@...ux-foundation.org>,
	Philipp Zabel <p.zabel@...gutronix.de>,
	Nicolin Chen <b42378@...escale.com>,
	Joe Perches <joe@...ches.com>,
	LKML <linux-kernel@...r.kernel.org>,
	DLOS <davinci-linux-open-source@...ux.davincidsp.com>
Subject: Re: [PATCH] lib/genalloc.c: add check gen_pool_dma_alloc() if dma
 pointer is not NULL

Hi Sachin,

On Thu, Jan 23, 2014 at 3:38 PM, Sachin Kamat <sachin.kamat@...aro.org> wrote:
> Hi Prabhakar,
>
> On 23 January 2014 15:26, Prabhakar Lad <prabhakar.csengg@...il.com> wrote:
>> From: "Lad, Prabhakar" <prabhakar.csengg@...il.com>
>>
>> In the gen_pool_dma_alloc() the dma pointer can be NULL
>> and while assigning gen_pool_virt_to_phys(pool, vaddr) to
>> dma caused the following crash on da850 evm,
>>
> [snip]
>>
>> Signed-off-by: Lad, Prabhakar <prabhakar.csengg@...il.com>
>> ---
>>  lib/genalloc.c |    3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/lib/genalloc.c b/lib/genalloc.c
>> index dda3116..f48163f 100644
>> --- a/lib/genalloc.c
>> +++ b/lib/genalloc.c
>> @@ -334,7 +334,8 @@ void *gen_pool_dma_alloc(struct gen_pool *pool, size_t size, dma_addr_t *dma)
>>         if (!vaddr)
>>                 return NULL;
>>
>> -       *dma = gen_pool_virt_to_phys(pool, vaddr);
>> +       if (dma)
>> +               *dma = gen_pool_virt_to_phys(pool, vaddr);
>
> Wouldn't it be better to return (with error/message) if dma is NULL
> rather than silently ignore it?
>
I am not sure if returning here with error is OK,
may be just adding a warning message could be OK ?

Regards,
--Prabhakar Lad
--
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