[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20130617130230.GX4107@intel.com>
Date: Mon, 17 Jun 2013 18:32:30 +0530
From: Vinod Koul <vinod.koul@...el.com>
To: Xiang Wang <wangxfdu@...il.com>
Cc: Dan Williams <djbw@...com>, linux-kernel@...r.kernel.org,
cxie4@...vell.com, Xiang Wang <wangx@...vell.com>
Subject: Re: [PATCH] dma: mmp_pdma: fix a memory alloc error
On Tue, May 28, 2013 at 08:05:13PM +0800, Xiang Wang wrote:
> From: Xiang Wang <wangx@...vell.com>
>
> pdev->phy is of type "struct mmp_pdma_phy *". But when
> allocating memory for it, "struct mmp_pdma_chan" is used
> by mistake.
>
> Signed-off-by: Xiang Wang <wangx@...vell.com>
> ---
> drivers/dma/mmp_pdma.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/dma/mmp_pdma.c b/drivers/dma/mmp_pdma.c
> index c26699f..76a8dcf 100644
> --- a/drivers/dma/mmp_pdma.c
> +++ b/drivers/dma/mmp_pdma.c
> @@ -801,7 +801,7 @@ static int mmp_pdma_probe(struct platform_device *op)
> }
>
> pdev->phy = devm_kzalloc(pdev->dev,
> - dma_channels * sizeof(struct mmp_pdma_chan), GFP_KERNEL);
> + dma_channels * sizeof(struct mmp_pdma_phy), GFP_KERNEL);
why not sizeof(*pdev-phy), that way you dont make above error
--
~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