Skip to content

cgroup: fix redundant NULL check in maybe_make_cgroup_threaded - #2204

Open
kolyshkin wants to merge 1 commit into
containers:mainfrom
kolyshkin:fix-redundant-null-check
Open

cgroup: fix redundant NULL check in maybe_make_cgroup_threaded#2204
kolyshkin wants to merge 1 commit into
containers:mainfrom
kolyshkin:fix-redundant-null-check

Conversation

@kolyshkin

Copy link
Copy Markdown
Collaborator

The consume_slashes() macro dereferences its argument (while (*_s == '/')), so checking path for NULL after calling it is too late — a NULL path would crash before the check ever runs.

Move the NULL check before consume_slashes(), keeping the empty-string check after it (still needed for inputs like "///").

Fixes the CodeQL alert https://github.com/containers/crun/security/code-scanning/16 (cpp/redundant-null-check-simple).

🤖 Generated with Claude Code

The consume_slashes() macro dereferences its argument, so checking
path for NULL afterwards is too late (and flagged by CodeQL as a
redundant null check due to previous dereference).

Move the NULL check before consume_slashes(), keeping the empty
string check after it (needed for inputs like "///").

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
@kolyshkin
kolyshkin force-pushed the fix-redundant-null-check branch from dc37127 to 40bd427 Compare August 25, 2026 07:27
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.

1 participant