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: <20061213163939.GJ3851@stusta.de>
Date:	Wed, 13 Dec 2006 17:39:39 +0100
From:	Adrian Bunk <bunk@...sta.de>
To:	"Robert P. J. Day" <rpjday@...dspring.com>
Cc:	Linux kernel mailing list <linux-kernel@...r.kernel.org>
Subject: Re: CodingStyle:  "kzalloc()" versus "kcalloc(1,...)"

On Thu, Dec 07, 2006 at 07:16:15PM -0500, Robert P. J. Day wrote:
> 
>   i just noticed that there are numerous invocations of kcalloc()
> where the hard-coded first arg of # elements is "1", which seems like
> an inappropriate use of kcalloc().
> 
>   the only rationale i can see is that kcalloc() guarantees that the
> memory will be set to zero, so i'm guessing that this form of
> kcalloc() was used before kzalloc() existed, or was used by folks who
> didn't know that kzalloc() existed.
> 
>   if a (zero-filled) single struct is being allocated, is it worth
> codifying that that allocation should use kzalloc() and not
> kcalloc(1,...)?

kcalloc() calls kzalloc(), so it doesn't matter at all which to use.

> rday

cu
Adrian

-- 

       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ