Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932070AbdGJThf (ORCPT ); Mon, 10 Jul 2017 15:37:35 -0400 Received: from gateway34.websitewelcome.com ([192.185.149.72]:21005 "EHLO gateway34.websitewelcome.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752158AbdGJThd (ORCPT ); Mon, 10 Jul 2017 15:37:33 -0400 Date: Mon, 10 Jul 2017 14:37:30 -0500 Message-ID: <20170710143730.Horde.NEj351PakRT3Rq0tNW6il2m@gator4166.hostgator.com> From: "Gustavo A. R. Silva" To: Darren Hart Cc: Jonathan Woithe , Andy Shevchenko , platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] platform/x86: fujitsu-laptop: add NULL check on devm_kzalloc() return value References: <20170706221902.GA29514@embeddedgus> <20170707001900.GE6573@marvin.atrad.com.au> <20170707170208.GB30284@fury> In-Reply-To: <20170707170208.GB30284@fury> User-Agent: Horde Application Framework 5 Content-Type: text/plain; charset=utf-8; format=flowed; DelSp=Yes MIME-Version: 1.0 Content-Disposition: inline X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator4166.hostgator.com X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - embeddedor.com X-BWhitelist: no X-Source-IP: 108.167.133.22 X-Exim-ID: 1dUeUt-0036xV-0d X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: gator4166.hostgator.com [108.167.133.22]:18603 X-Source-Auth: garsilva@embeddedor.com X-Email-Count: 34 X-Source-Cap: Z3V6aWRpbmU7Z3V6aWRpbmU7Z2F0b3I0MTY2Lmhvc3RnYXRvci5jb20= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 950 Lines: 42 Hi Darren, Jonathan, Quoting Darren Hart : > 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 >> >> 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 > > Thanks Gustavo and Jonathan, > > Queued to testing. > Glad to help. :) Thanks -- Gustavo A. R. Silva