[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1505896209.7865.1.camel@pengutronix.de>
Date: Wed, 20 Sep 2017 10:30:09 +0200
From: Philipp Zabel <p.zabel@...gutronix.de>
To: Arvind Yadav <arvind.yadav.cs@...il.com>, mchehab@...nel.org,
hans.verkuil@...co.com, sean@...s.org, andi.shyti@...sung.com
Cc: linux-media@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] [media] coda: Handle return value of kasprintf
Hi Arvind,
On Wed, 2017-09-20 at 13:07 +0530, Arvind Yadav wrote:
> kasprintf() can fail here and we must check its return value.
>
> Signed-off-by: Arvind Yadav <arvind.yadav.cs@...il.com>
> ---
> drivers/media/platform/coda/coda-bit.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/media/platform/coda/coda-bit.c b/drivers/media/platform/coda/coda-bit.c
> index 291c409..8d78183 100644
> --- a/drivers/media/platform/coda/coda-bit.c
> +++ b/drivers/media/platform/coda/coda-bit.c
> @@ -417,6 +417,9 @@ static int coda_alloc_framebuffers(struct coda_ctx *ctx,
> > dev->devtype->product != CODA_DX6)
> > size += ysize / 4;
> > name = kasprintf(GFP_KERNEL, "fb%d", i);
> + if (!name)
> + return -ENOMEM;
> +
Thank you for the patch. Instead of just returning here, this should
also call coda_free_framebuffers to release already allocated buffers in
earlier iterations of the loop.
regards
Philipp
Powered by blists - more mailing lists