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]
Message-ID: <1318397400.1546.368.camel@vkoul-udesk3>
Date:	Wed, 12 Oct 2011 11:00:00 +0530
From:	Vinod Koul <vinod.koul@...el.com>
To:	Tomoya MORINAGA <tomoya-linux@....lapis-semi.com>
Cc:	Dan Williams <dan.j.williams@...el.com>,
	linux-kernel@...r.kernel.org, qi.wang@...el.com,
	yong.y.wang@...el.com, joel.clark@...el.com, kok.howg.ewe@...el.com
Subject: Re: [PATCH 2/2 v2] pch_dma: Reduce wasting memory

On Wed, 2011-10-12 at 09:38 +0900, Tomoya MORINAGA wrote:
> nr_channels is defined in "struct pch_dma".
> and struct pch_dma_chan is defined in "struct pch_dma".
> So, "sizeof(struct pch_dma_chan) * nr_channels" is unnecessary.
> 
> Signed-off-by: Tomoya MORINAGA <tomoya-linux@....lapis-semi.com>
> ---
> v2: Change sizeof(struct pch_dma) to sizeof(*pd)
> ---
>  drivers/dma/pch_dma.c |    3 +--
>  1 files changed, 1 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/dma/pch_dma.c b/drivers/dma/pch_dma.c
> index 326fedc..58b215c 100644
> --- a/drivers/dma/pch_dma.c
> +++ b/drivers/dma/pch_dma.c
> @@ -997,8 +997,7 @@ static int __devinit pch_dma_probe(struct pci_dev *pdev,
>  	int i;
>  
>  	nr_channels = id->driver_data;
> -	pd = kzalloc(sizeof(struct pch_dma)+
> -		sizeof(struct pch_dma_chan) * nr_channels, GFP_KERNEL);
> +	pd = kzalloc(sizeof(*pd), GFP_KERNEL);
>  	if (!pd)
>  		return -ENOMEM;
>  
Applied thanks.

Although we can further optimize by removing static array and
dynamically allocate channel structures based on nr_channels, that can
be taken further separately.

-- 
~Vinod

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