[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1347939374.1943.172.camel@vkoul-udesk3>
Date: Tue, 18 Sep 2012 09:06:14 +0530
From: Vinod Koul <vinod.koul@...ux.intel.com>
To: Sachin Kamat <sachin.kamat@...aro.org>
Cc: linux-kernel@...r.kernel.org, jassisinghbrar@...il.com,
patches@...aro.org
Subject: Re: [PATCH 2/2] DMA: PL330: Check the pointer returned by kzalloc
On Mon, 2012-09-17 at 15:20 +0530, Sachin Kamat wrote:
> kzalloc could return NULL. Hence add a check to avoid
> NULL pointer dereference.
>
> Signed-off-by: Sachin Kamat <sachin.kamat@...aro.org>
> ---
> drivers/dma/pl330.c | 5 +++++
> 1 files changed, 5 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c
> index 018a445..5d3bbcd 100644
> --- a/drivers/dma/pl330.c
> +++ b/drivers/dma/pl330.c
> @@ -2930,6 +2930,11 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id)
> num_chan = max_t(int, pi->pcfg.num_peri, pi->pcfg.num_chan);
>
> pdmac->peripherals = kzalloc(num_chan * sizeof(*pch), GFP_KERNEL);
> + if (!pdmac->peripherals) {
> + ret = -ENOMEM;
> + dev_err(&adev->dev, "unable to allocate pdmac->peripherals\n");
> + goto probe_err5;
> + }
>
> for (i = 0; i < num_chan; i++) {
> pch = &pdmac->peripherals[i];
Thanks applied both to fixes.
I have cc'ed stable as well
--
~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