Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1683321
| From | Darren Hart <dvhart@infradead.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] platform/x86: fujitsu-laptop: add NULL check on devm_kzalloc() return value |
| Date | 2017-07-07 19:10 +0200 |
| Message-ID | <u0EVs-71k-25@gated-at.bofh.it> (permalink) |
| References | <u0nrA-3is-35@gated-at.bofh.it> <u0pjH-4tw-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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. -- Darren Hart VMware Open Source Technology Center
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH] platform/x86: fujitsu-laptop: add NULL check on devm_kzalloc() return value "Gustavo A. R. Silva" <garsilva@embeddedor.com> - 2017-07-07 00:30 +0200
Re: [PATCH] platform/x86: fujitsu-laptop: add NULL check on devm_kzalloc() return value Jonathan Woithe <jwoithe@just42.net> - 2017-07-07 02:30 +0200
Re: [PATCH] platform/x86: fujitsu-laptop: add NULL check on devm_kzalloc() return value Darren Hart <dvhart@infradead.org> - 2017-07-07 19:10 +0200
Re: [PATCH] platform/x86: fujitsu-laptop: add NULL check on devm_kzalloc() return value "Gustavo A. R. Silva" <garsilva@embeddedor.com> - 2017-07-10 21:40 +0200
csiph-web