[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Fri, 7 Jul 2017 10:02:08 -0700
From: Darren Hart <dvhart@...radead.org>
To: Jonathan Woithe <jwoithe@...t42.net>
Cc: "Gustavo A. R. Silva" <garsilva@...eddedor.com>,
Andy Shevchenko <andy@...radead.org>,
platform-driver-x86@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] platform/x86: fujitsu-laptop: add NULL check on
devm_kzalloc() return value
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@...eddedor.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@...t42.net>
Thanks Gustavo and Jonathan,
Queued to testing.
--
Darren Hart
VMware Open Source Technology Center
Powered by blists - more mailing lists