linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/2] [media] coda: Handle return value of kasprintf
@ 2017-09-20  9:40 Arvind Yadav
  2017-09-20 10:04 ` Philipp Zabel
  0 siblings, 1 reply; 2+ messages in thread
From: Arvind Yadav @ 2017-09-20  9:40 UTC (permalink / raw)
  To: p.zabel, mchehab, hans.verkuil, sean, andi.shyti
  Cc: linux-media, linux-kernel

kasprintf() can fail here and we must check its return value.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
---
changes in v2 :
	Calling coda_free_framebuffers to release already allocated buffers.

 drivers/media/platform/coda/coda-bit.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/media/platform/coda/coda-bit.c b/drivers/media/platform/coda/coda-bit.c
index 291c409..bfc4ecf 100644
--- a/drivers/media/platform/coda/coda-bit.c
+++ b/drivers/media/platform/coda/coda-bit.c
@@ -417,6 +417,10 @@ 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) {
+			coda_free_framebuffers(ctx);
+			return -ENOMEM;
+		}
 		ret = coda_alloc_context_buf(ctx, &ctx->internal_frames[i],
 					     size, name);
 		kfree(name);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2 1/2] [media] coda: Handle return value of kasprintf
  2017-09-20  9:40 [PATCH v2 1/2] [media] coda: Handle return value of kasprintf Arvind Yadav
@ 2017-09-20 10:04 ` Philipp Zabel
  0 siblings, 0 replies; 2+ messages in thread
From: Philipp Zabel @ 2017-09-20 10:04 UTC (permalink / raw)
  To: Arvind Yadav, mchehab, hans.verkuil, sean, andi.shyti
  Cc: linux-media, linux-kernel

On Wed, 2017-09-20 at 15:10 +0530, Arvind Yadav wrote:
> kasprintf() can fail here and we must check its return value.
> 
> Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
---
> changes in v2 :
> 	Calling coda_free_framebuffers to release already allocated buffers.

Thanks,

Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>

regards
Philipp

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-09-20 10:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-20  9:40 [PATCH v2 1/2] [media] coda: Handle return value of kasprintf Arvind Yadav
2017-09-20 10:04 ` Philipp Zabel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).