lkml.org 
[lkml]   [2017]   [Jul]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] platform/x86: fujitsu-laptop: add NULL check on devm_kzalloc() return value
Hi Darren, Jonathan,

Quoting Darren Hart <dvhart@infradead.org>:

> On Fri, Jul 07, 2017 at 09:49:00AM +0930, Jonathan Woithe wrote:
>> On Thu, Jul 06, 2017 at 05:19:02PM -0500, Gustavo A. R. Silva wrote:
>> > Check return value from call to devm_kzalloc()
>> > in order to prevent a NULL pointer dereference.
>> >
>> > This issue was detected using Coccinelle and the following semantic patch:
>> >
>> > @@
>> > expression x;
>> > identifier fld;
>> > @@
>> >
>> > * x = devm_kzalloc(...);
>> > ... when != x == NULL
>> > x->fld
>> >
>> > Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
>>
>> These checks should be added in the interest of code correctness.
>> devm_kzalloc() can fail (even if it's extremely unlikely in practice) so we
>> should check for this.
>>
>> Reviewed-by: Jonathan Woithe <jwoithe@just42.net>
>
> Thanks Gustavo and Jonathan,
>
> Queued to testing.
>

Glad to help. :)

Thanks
--
Gustavo A. R. Silva





\
 
 \ /
  Last update: 2017-07-10 21:38    [W:0.058 / U:0.032 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site