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]
Date:	Wed, 19 Jul 2006 22:52:00 +1000
From:	Paul Mackerras <paulus@...ba.org>
To:	takis@...umba.uhasselt.be (Panagiotis Issaris)
Cc:	linux-kernel@...r.kernel.org, len.brown@...el.com,
	chas@....nrl.navy.mil, miquel@...uba.ar, kkeil@...e.de,
	benh@...nel.crashing.org, video4linux-list@...hat.com,
	rmk+mmc@....linux.org.uk, Neela.Kolli@...enio.com,
	jgarzik@...ox.com, vandrove@...cvut.cz, adaplas@....net,
	thomas@...ischhofer.net, weissg@...nna.at, philb@....org,
	linux-pcmcia@...ts.infradead.org, jkmaline@...hut.fi
Subject: Re: [PATCH] drivers: Conversions from kmalloc+memset to k(z|c)alloc.

Panagiotis Issaris writes:

> diff --git a/drivers/video/aty/atyfb_base.c b/drivers/video/aty/atyfb_base.c
> index 1507d19..48c6f83 100644
> --- a/drivers/video/aty/atyfb_base.c
> +++ b/drivers/video/aty/atyfb_base.c
> @@ -2995,12 +2995,11 @@ static int __devinit atyfb_setup_sparc(s
>  		/* nothing */ ;
>  	j = i + 4;
>  
> -	par->mmap_map = kmalloc(j * sizeof(*par->mmap_map), GFP_ATOMIC);
> +	par->mmap_map = kcalloc(j, sizeof(*par->mmap_map), GFP_ATOMIC);
>  	if (!par->mmap_map) {
>  		PRINTKE("atyfb_setup_sparc() can't alloc mmap_map\n");
>  		return -ENOMEM;
>  	}
> -	memset(par->mmap_map, 0, j * sizeof(*par->mmap_map));

What exactly do we gain by using kcalloc rather than kzalloc here?
There is no potential overflow issue to worry about.

> @@ -464,7 +463,7 @@ #ifdef __sparc__
>  	 * one additional region with size == 0. 
>  	 */
>  
> -	par->mmap_map = kmalloc(4 * sizeof(*par->mmap_map), GFP_ATOMIC);
> +	par->mmap_map = kcalloc(4, sizeof(*par->mmap_map), GFP_ATOMIC);

Likewise.

Paul.
-
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