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: <20170509123158.GA2440@lianli.shorne-pla.net>
Date:   Tue, 9 May 2017 21:31:58 +0900
From:   Stafford Horne <shorne@...il.com>
To:     Dan Carpenter <dan.carpenter@...cle.com>
Cc:     Christophe JAILLET <christophe.jaillet@...adoo.fr>,
        linus.walleij@...aro.org, gary.bisson@...ndarydevices.com,
        vladimir_zapolskiy@...tor.com, tony@...mide.com,
        vivien.didelot@...oirfairelinux.com, linux-gpio@...r.kernel.org,
        linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: Re: [PATCH] pinctrl: imx: Check for memory allocation failure

On Tue, May 09, 2017 at 10:27:20AM +0300, Dan Carpenter wrote:
> On Sun, May 07, 2017 at 04:40:38AM +0900, Stafford Horne wrote:
> > Hi Christophe,
> > 
> > On Sat, May 06, 2017 at 10:23:59AM +0200, Christophe JAILLET wrote:
> > > If 'devm_kzalloc' fails, a NULL pointer will be dereferenced.
> > > Return -ENOMEM instead, as done for the other memory allocation just a
> > > few lines below.
> > 
> > This looks fine.
> > 
> > > BTW, change the 'devm_kzalloc' into a 'devm_kcalloc'.
> > 
> > Any reason for the devm_kcalloc change?  It looks like the next for loop
> > does set all of the group_name values.
> > 
> 
> The advantage of kcalloc() over kzalloc() is the integer overflow
> checking.  There is kmalloc_array() if we don't need to zero the memory.

Right, usually its good to have a reason why in the commit log. i.e.

 BTW, change the 'devm_kzalloc' into a 'devm_kcalloc' for overflow checking.

Or switch to devm_kmalloc_array() and say: for overflow checking and no
need for zeroing.

-Stafford

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ