Skip to content

media prompts: recognize V4L2 check_state callback invariant#339

Merged
rgushchin merged 2 commits into
sashiko-dev:mainfrom
OllieinCanada:fix/issue-334-v4l2-false-positive
Jul 20, 2026
Merged

media prompts: recognize V4L2 check_state callback invariant#339
rgushchin merged 2 commits into
sashiko-dev:mainfrom
OllieinCanada:fix/issue-334-v4l2-false-positive

Conversation

@OllieinCanada

@OllieinCanada OllieinCanada commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Fixes #334

Summary

Teach Sashiko to account for caller-side V4L2 subdevice state validation before
reporting a possible NULL dereference involving
v4l2_subdev_state_get_format() inside a registered driver callback.

The Media/V4L2 subsystem prompt requires the reviewer to inspect the actual
media-core callback path and dismiss the concern only when the matching wrapper
proves that the same state, pad, stream, operation, and relevant configuration
were validated before callback dispatch.

Root cause

The affected driver callbacks are reached indirectly through V4L2 operation
tables. Their validating wrappers live in the media core rather than in the
driver callback itself.

Reviewing only the callback can therefore make a protected lookup appear to be
an unchecked dereference.

Changes

  • add a Media/V4L2 subsystem prompt
  • register Media/V4L2 paths and symbols in the subsystem prompt index
  • require concrete caller-side proof before dismissing the warning
  • retain the warning when a caller bypasses the wrapper, values differ, the
    guard is conditional, or the required context is unavailable

Scope

This change does not assume that
v4l2_subdev_state_get_format() is globally non-NULL and does not suppress
V4L2 NULL-dereference findings broadly.

Following maintainer feedback, the submitted diff is intentionally limited to
the subsystem prompt and its index entry.

Validation

  • confirmed the cumulative pull-request diff contains only the Media/V4L2
    prompt and subsystem index
  • manually inspected the prompt’s guarded and unsafe reasoning boundaries
  • git diff --check passes
  • no model-backed regression tests are included in this pull request

Signed-off-by: OllieinCanada <73385593+OllieinCanada@users.noreply.github.com>
@OllieinCanada
OllieinCanada marked this pull request as ready for review July 19, 2026 18:52
@rgushchin

Copy link
Copy Markdown
Member

Thank you for the PR! Prompt changes look good to me, but I'd drop the rest. I don't think we want to add tests like this right now - they might not be stable due to the nature of LLMs. We can return to this question separately. Also, please don't change the REVISION file. Let's just change the prompt and the index file. Thanks!

Signed-off-by: OllieinCanada <73385593+OllieinCanada@users.noreply.github.com>
@OllieinCanada

Copy link
Copy Markdown
Contributor Author

Thanks for the review. I’ve narrowed the PR to the Media/V4L2 prompt and subsystem index only, and removed the tests, fixtures, prompt-bundle changes, README update, and REVISION change. The cumulative diff now contains only those two files.

@rgushchin
rgushchin merged commit 8ac8e51 into sashiko-dev:main Jul 20, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

From Mauro Carvalho Chehab, media promtps improvements needed

2 participants