coda: Handle return value of kasprintf
PATCH v2 1/2 coda: Handle return value of kasprintf
kasprintf() can fail here and we must check its return value.
Signed-off-by Arvind Yadav <[email protected]>
---
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(+)
drivers/media/platform/coda/coda-bit.c +4 -0
@@ -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);
Signature · 1 line
1.9.1
Quoted 3 lines · Arvind Yadav
kasprintf()can fail here and we must check its return value.Signed-off-by Arvind Yadav <[email protected]>
---
Quoted 2 lines
changes in v2 :
Callingcoda_free_framebuffersto release already allocated buffers.
Thanks,
Reviewed-by Philipp Zabel <[email protected]>
regards
Philipp