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>] [day] [month] [year] [list]
Message-ID: <20140502142117.GC4631@saruman.home>
Date:	Fri, 2 May 2014 09:21:17 -0500
From:	Felipe Balbi <balbi@...com>
To:	George Cherian <george.cherian@...com>
CC:	<linux-kernel@...r.kernel.org>, <netdev@...r.kernel.org>,
	<mugunthanvnm@...com>, <davem@...emloft.net>, <balbi@...com>,
	<zonque@...il.com>, <mpa@...gutronix.de>,
	<bhutchings@...arflare.com>
Subject: Re: [PATCH 3/3] drivers: net: davinci_cpdma: Convert kzalloc() to
 devm_kzalloc().

Hi,

On Fri, May 02, 2014 at 03:50:17PM +0530, George Cherian wrote:
> Convert kzalloc() to devm_kzalloc().
> 
> Signed-off-by: George Cherian <george.cherian@...com>
> ---
>  drivers/net/ethernet/ti/davinci_cpdma.c | 32 ++++++++++++--------------------
>  1 file changed, 12 insertions(+), 20 deletions(-)
> 
> diff --git a/drivers/net/ethernet/ti/davinci_cpdma.c b/drivers/net/ethernet/ti/davinci_cpdma.c
> index 88ef270..b83ffbb 100644
> --- a/drivers/net/ethernet/ti/davinci_cpdma.c
> +++ b/drivers/net/ethernet/ti/davinci_cpdma.c
> @@ -158,9 +158,9 @@ cpdma_desc_pool_create(struct device *dev, u32 phys, u32 hw_addr,
>  	int bitmap_size;
>  	struct cpdma_desc_pool *pool;
>  
> -	pool = kzalloc(sizeof(*pool), GFP_KERNEL);
> +	pool = devm_kzalloc(dev, sizeof(*pool), GFP_KERNEL);
>  	if (!pool)
> -		return NULL;
> +		goto fail;
>  
>  	spin_lock_init(&pool->lock);
>  
> @@ -170,7 +170,7 @@ cpdma_desc_pool_create(struct device *dev, u32 phys, u32 hw_addr,
>  	pool->num_desc	= size / pool->desc_size;
>  
>  	bitmap_size  = (pool->num_desc / BITS_PER_LONG) * sizeof(long);
> -	pool->bitmap = kzalloc(bitmap_size, GFP_KERNEL);
> +	pool->bitmap = devm_kzalloc(dev, bitmap_size, GFP_KERNEL);
>  	if (!pool->bitmap)
>  		goto fail;
>  
> @@ -187,10 +187,7 @@ cpdma_desc_pool_create(struct device *dev, u32 phys, u32 hw_addr,
>  
>  	if (pool->iomap)
>  		return pool;
> -
>  fail:
> -	kfree(pool->bitmap);
> -	kfree(pool);

remove kfree() on cpda_desc_pool_destroy() too.

>  	return NULL;
>  }
>  
> @@ -276,7 +273,7 @@ struct cpdma_ctlr *cpdma_ctlr_create(struct cpdma_params *params)
>  {
>  	struct cpdma_ctlr *ctlr;
>  
> -	ctlr = kzalloc(sizeof(*ctlr), GFP_KERNEL);
> +	ctlr = devm_kzalloc(params->dev, sizeof(*ctlr), GFP_KERNEL);

likewise, drop the kfree() in cpdma_ctlr_destroy()

Fix those and you can add

Reviewed-by: Felipe Balbi <balbi@...com>

-- 
balbi

Download attachment "signature.asc" of type "application/pgp-signature" (820 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ