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:	Wed, 03 Aug 2011 17:54:04 +0200
From:	Thomas Meyer <thomas@...3r.de>
To:	Julia Lawall <julia@...u.dk>
Cc:	linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: Re: [PATCH 8/20] drivers/parport: Use kzalloc

Am Donnerstag, den 13.05.2010, 22:01 +0200 schrieb Julia Lawall:

> From: Julia Lawall <julia@...u.dk>
> 
> Use kzalloc rather than the combination of kmalloc and memset.
> 
> The semantic patch that makes this change is as follows:
> (http://coccinelle.lip6.fr/)
> 
> // <smpl>
> @@
> expression x,size,flags;
> statement S;
> @@
> 
> -x = kmalloc(size,flags);
> +x = kzalloc(size,flags);
>  if (x == NULL) S
> -memset(x, 0, size);
> // </smpl>
> 
> Signed-off-by: Julia Lawall <julia@...u.dk>

Reviewed-by: Thomas Meyer <thomas@...3r.de>

> 
> ---
>  drivers/parport/share.c |    3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff -u -p a/drivers/parport/share.c b/drivers/parport/share.c
> --- a/drivers/parport/share.c
> +++ b/drivers/parport/share.c
> @@ -282,14 +282,13 @@ struct parport *parport_register_port(un
>  	int device;
>  	char *name;
>  
> -	tmp = kmalloc(sizeof(struct parport), GFP_KERNEL);
> +	tmp = kzalloc(sizeof(struct parport), GFP_KERNEL);
>  	if (!tmp) {
>  		printk(KERN_WARNING "parport: memory squeeze\n");
>  		return NULL;
>  	}
>  
>  	/* Init our structure */
> - 	memset(tmp, 0, sizeof(struct parport));
>  	tmp->base = base;
>  	tmp->irq = irq;
>  	tmp->dma = dma;



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