summaryrefslogtreecommitdiff
path: root/drivers/media
diff options
context:
space:
mode:
authorMirela Rabulea <mirela.rabulea@nxp.com>2021-09-27 21:56:32 +0300
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>2021-10-08 12:26:13 +0300
commit83f5f0633b156c636f5249d3c10f2a9423dd4c96 (patch)
tree2ff3d412fb3b9256f7ceaddce5ca7cfe2196b37b /drivers/media
parent64cdf7e5a3aac0e7c9efdb079e74e22875b0419a (diff)
downloadlinux-83f5f0633b156c636f5249d3c10f2a9423dd4c96.tar.xz
media: imx-jpeg: Fix possible null pointer dereference
Found by Coverity scan. Signed-off-by: Mirela Rabulea <mirela.rabulea@nxp.com> Reviewed-by: Laurentiu Palcu <laurentiu.palcu@nxp.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/platform/imx-jpeg/mxc-jpeg.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/media/platform/imx-jpeg/mxc-jpeg.c b/drivers/media/platform/imx-jpeg/mxc-jpeg.c
index 73e73b6f2e5b..512baf75f9e3 100644
--- a/drivers/media/platform/imx-jpeg/mxc-jpeg.c
+++ b/drivers/media/platform/imx-jpeg/mxc-jpeg.c
@@ -575,6 +575,10 @@ static irqreturn_t mxc_jpeg_dec_irq(int irq, void *priv)
dst_buf = v4l2_m2m_next_dst_buf(ctx->fh.m2m_ctx);
src_buf = v4l2_m2m_next_src_buf(ctx->fh.m2m_ctx);
+ if (!dst_buf || !src_buf) {
+ dev_err(dev, "No source or destination buffer.\n");
+ goto job_unlock;
+ }
jpeg_src_buf = vb2_to_mxc_buf(&src_buf->vb2_buf);
if (dec_ret & SLOT_STATUS_ENC_CONFIG_ERR) {