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] [day] [month] [year] [list]
Message-ID: <e7217d5e-44e6-a6fa-33a1-e3c85f0c36bc@redhat.com>
Date:   Mon, 29 Aug 2016 18:38:53 +0200
From:   Paolo Bonzini <pbonzini@...hat.com>
To:     wharms@....de
Cc:     SF Markus Elfring <elfring@...rs.sourceforge.net>,
        sparclinux@...r.kernel.org,
        "David S. Miller" <davem@...emloft.net>,
        LKML <linux-kernel@...r.kernel.org>,
        kernel-janitors@...r.kernel.org,
        Julia Lawall <julia.lawall@...6.fr>
Subject: Re: [PATCH 1/2] sparc: Use kmalloc_array() in three functions



On 29/08/2016 13:57, walter harms wrote:
> > > -	buf = kmalloc(sizeof(char) * (count + 1), GFP_KERNEL);
> > > +	buf = kmalloc_array(count + 1, sizeof(*buf), GFP_KERNEL);
> > >  	if (!buf)
> > >  		return -ENOMEM;
> > >  
> > 
> > Here it's probably best to just remove sizeof(char) completely, as it's
> > 1 by definition.
> 
> I would not do so, if you ever change buf to something else it would break,
> having a sizeof(*buf) here is harmless and a known pattern.

Fair enough, it's not code I maintain.

Paolo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ