Skip to content

Commit 2017172

Browse files
Chen Zhoumchehab
authored andcommitted
media: coda: jpeg: add NULL check after kmalloc
Fixes coccicheck warning: ./drivers/media/platform/coda/coda-jpeg.c:331:3-31: alloc with no test, possible model on line 354 Add NULL check after kmalloc. Signed-off-by: Chen Zhou <chenzhou10@huawei.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
1 parent 6fce59a commit 2017172

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

‎drivers/media/platform/coda/coda-jpeg.c‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,8 +327,11 @@ int coda_jpeg_decode_header(struct coda_ctx *ctx, struct vb2_buffer *vb)
327327
"only 8-bit quantization tables supported\n");
328328
continue;
329329
}
330-
if (!ctx->params.jpeg_qmat_tab[i])
330+
if (!ctx->params.jpeg_qmat_tab[i]) {
331331
ctx->params.jpeg_qmat_tab[i] = kmalloc(64, GFP_KERNEL);
332+
if (!ctx->params.jpeg_qmat_tab[i])
333+
return -ENOMEM;
334+
}
332335
memcpy(ctx->params.jpeg_qmat_tab[i],
333336
quantization_tables[i].start, 64);
334337
}

0 commit comments

Comments
 (0)