lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20260112120749.90664-1-mdmitrichenko@astralinux.ru>
Date: Mon, 12 Jan 2026 15:07:49 +0300
From: Mikhail Dmitrichenko <mdmitrichenko@...ralinux.ru>
To: Hans de Goede <hansg@...nel.org>
Cc: Mikhail Dmitrichenko <mdmitrichenko@...ralinux.ru>,
	Mauro Carvalho Chehab <mchehab@...nel.org>,
	Sakari Ailus <sakari.ailus@...ux.intel.com>,
	Andy Shevchenko <andy@...nel.org>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	"Peter Zijlstra (Intel)" <peterz@...radead.org>,
	Thomas Andreatta <thomas.andreatta2000@...il.com>,
	Josh Poimboeuf <jpoimboe@...nel.org>,
	Ingo Molnar <mingo@...nel.org>,
	Alan Cox <alan@...ux.intel.com>,
	linux-media@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	linux-staging@...ts.linux.dev,
	lvc-project@...uxtesting.org
Subject: [PATCH v2] media: staging: atomisp: remove unnecessary NULL checks in sensor drivers

There are unnecessary NULL checks for v4l2_subdev_format::format
pointer in ov2722 and gc2235 sensor driver format operations.
The fmt pointer is derived from &format->format where format
is a pointer to an embedded struct v4l2_mbus_framefmt inside
struct v4l2_subdev_format, therefore fmt cannot be NULL.

Remove unnecessary NULL checks for v4l2_subdev_format::format
pointer to avoid unnecessary computations and make code
clearer.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Signed-off-by: Mikhail Dmitrichenko <mdmitrichenko@...ralinux.ru>
---
 drivers/staging/media/atomisp/i2c/atomisp-gc2235.c | 5 -----
 drivers/staging/media/atomisp/i2c/atomisp-ov2722.c | 4 ----
 2 files changed, 9 deletions(-)

diff --git a/drivers/staging/media/atomisp/i2c/atomisp-gc2235.c b/drivers/staging/media/atomisp/i2c/atomisp-gc2235.c
index 6050637a0def..98d43b93a3ba 100644
--- a/drivers/staging/media/atomisp/i2c/atomisp-gc2235.c
+++ b/drivers/staging/media/atomisp/i2c/atomisp-gc2235.c
@@ -535,8 +535,6 @@ static int gc2235_set_fmt(struct v4l2_subdev *sd,
 		return -EINVAL;
 	if (format->pad)
 		return -EINVAL;
-	if (!fmt)
-		return -EINVAL;
 
 	mutex_lock(&dev->input_lock);
 	res = v4l2_find_nearest_size(gc2235_res_preview,
@@ -577,9 +575,6 @@ static int gc2235_get_fmt(struct v4l2_subdev *sd,
 	if (format->pad)
 		return -EINVAL;
 
-	if (!fmt)
-		return -EINVAL;
-
 	fmt->width = dev->res->width;
 	fmt->height = dev->res->height;
 	fmt->code = MEDIA_BUS_FMT_SGRBG10_1X10;
diff --git a/drivers/staging/media/atomisp/i2c/atomisp-ov2722.c b/drivers/staging/media/atomisp/i2c/atomisp-ov2722.c
index a4519babf37d..aaf30f072ad5 100644
--- a/drivers/staging/media/atomisp/i2c/atomisp-ov2722.c
+++ b/drivers/staging/media/atomisp/i2c/atomisp-ov2722.c
@@ -635,8 +635,6 @@ static int ov2722_set_fmt(struct v4l2_subdev *sd,
 
 	if (format->pad)
 		return -EINVAL;
-	if (!fmt)
-		return -EINVAL;
 	ov2722_info = v4l2_get_subdev_hostdata(sd);
 	if (!ov2722_info)
 		return -EINVAL;
@@ -705,8 +703,6 @@ static int ov2722_get_fmt(struct v4l2_subdev *sd,
 
 	if (format->pad)
 		return -EINVAL;
-	if (!fmt)
-		return -EINVAL;
 
 	fmt->width = dev->res->width;
 	fmt->height = dev->res->height;
-- 
2.39.2


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ