Re: [PATCH v2 2/3] media: i2c: Add driver for OmniVision OV32C4
From: Robert Bozik
Date: Fri Aug 28 2026 - 10:02:50 EST
On Fri, Aug 28, 2026, sashiko-bot@xxxxxxxxxx wrote:
> [Severity: High]
> Potential NULL pointer dereference in ov32c4_set_format() when
> sd_state is NULL.
I checked this and I do not believe it is a defect here, so I have not
changed the code. Please tell me if you disagree.
The mechanism is described accurately as far as it goes: check_state()
only rejects a NULL state for V4L2_SUBDEV_FORMAT_TRY, so an ACTIVE call
passes the guard, and __v4l2_subdev_state_get_format() does return NULL
for a NULL state.
But that function opens with
if (WARN_ON_ONCE(!state))
return NULL;
so a NULL state there is treated as a bug to be reported, not as an
input to be handled. And 37 drivers under drivers/media/i2c/ assign
through it exactly the way this one does, none of them checking the
result; the line here is identical to ov02c10.c:712, which is the
driver this one was modelled on.
So if that path is reachable, it is a core problem affecting all of
them and the fix belongs in the core rather than in a new sensor
driver - adding a check only here would make this the one driver in
the subsystem that does it. I am happy to add it if you would prefer.
Thanks,
Robert