From 48bbbfe9768ab9065ee969965ae7de19b047ba6e Mon Sep 17 00:00:00 2001 From: sudarsan N Date: Wed, 18 Jun 2025 15:43:02 +0530 Subject: [PATCH] drivers: video: fix NULL dereference in mipid02_get_fmt Category: Null pointer dereference (CWE-476) Corrects the logic that validates the result of mipid04_get_format_desc(). Previously, the check was inverted, which could lead to a NULL pointer dereference when accessing desc->pixelformat. Fixes Coverity CID: 525183 Signed-off-by: sudarsan N --- drivers/video/video_st_mipid02.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/video/video_st_mipid02.c b/drivers/video/video_st_mipid02.c index 88d9aabb158..0b2493619a6 100644 --- a/drivers/video/video_st_mipid02.c +++ b/drivers/video/video_st_mipid02.c @@ -189,7 +189,7 @@ static int mipid02_get_fmt(const struct device *dev, struct video_format *fmt) } desc = mipid02_get_format_desc(fmt->pixelformat); - if (desc) { + if (desc == NULL) { LOG_ERR("Sensor format not supported by the ST-MIPID02"); return -EIO; }