Skip to contentSkip to conversation

media: imx-jpeg: Fix possible null pointer dereference

PATCH New Mirela Rabulea 1 participant 1 message Sep 27, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 media: imx-jpeg: Fix possible null pointer dereference

Found by Coverity scan.

---
 drivers/media/platform/imx-jpeg/mxc-jpeg.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/media/platform/imx-jpeg/mxc-jpeg.c +4 -0
index 2e1fef88cdf0..b1678f94dccd 100644
@@ -576,6 +576,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) {
Signature · 1 line
2.25.1