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]
Date:	Mon, 22 Jun 2015 16:13:25 +0200
From:	Peter Oberparleiter <oberpar@...ux.vnet.ibm.com>
To:	Maninder Singh <maninder1.s@...sung.com>,
	linux-kernel@...r.kernel.org, shanky.cool1992@...il.com
CC:	pankaj.m@...sung.com
Subject: Re: [Resend PATCH 1/1] kernel/gcov/fs.c: Use kzalloc for allocating
 one thing

On 22.06.2015 15:24, Maninder Singh wrote:
> Use kzalloc rather than kcalloc(1.. for allocation
> of one thing.
> 
> Signed-off-by: Maninder Singh <maninder1.s@...sung.com>
> Reviewed-by: Vaneet Narang <v.narang@...sung.com>
> ---
>  kernel/gcov/fs.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/kernel/gcov/fs.c b/kernel/gcov/fs.c
> index edf67c4..b31701a 100644
> --- a/kernel/gcov/fs.c
> +++ b/kernel/gcov/fs.c
> @@ -437,7 +437,7 @@ static struct gcov_node *new_node(struct gcov_node *parent,
>  	if (!node)
>  		goto err_nomem;
>  	if (info) {
> -		node->loaded_info = kcalloc(1, sizeof(struct gcov_info *),
> +		node->loaded_info = kzalloc(sizeof(struct gcov_info *),

Using kcalloc makes it more obvious to readers that the entity being
allocated is in fact an array, even if it starts out with only one
element. This implicit bit of information would be lost when using
kzalloc. Therefore I'd like to keep the current version for better
readability.

>  					   GFP_KERNEL);
>  		if (!node->loaded_info)
>  			goto err_nomem;
> 

-- 
Peter Oberparleiter
Linux on z Systems Development - IBM Germany

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ