Skip to content

tools: rp2040: Drop uninitialized name length check#19320

Merged
xiaoxiang781216 merged 1 commit into
apache:masterfrom
Old-Ding:codex/rp2040-flashfs-name-len
Jul 10, 2026
Merged

tools: rp2040: Drop uninitialized name length check#19320
xiaoxiang781216 merged 1 commit into
apache:masterfrom
Old-Ding:codex/rp2040-flashfs-name-len

Conversation

@Old-Ding

@Old-Ding Old-Ding commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Summary

  • remove the stale pre-opendir() name_len check in scan_dir()
  • keep directory entry name validation in the loop where a_dirent->d_name is available

Why

scan_dir() checked name_len before assigning it. That means the tool can branch on an uninitialized local variable before opening the directory. The actual filesystem entry names are already measured and checked after readdir() returns each regular file or directory.

Testing

  • git diff --check origin/master..HEAD
  • git show --check --stat --oneline HEAD
  • local compile/checkpatch not run: this Windows environment has no usable gcc/clang/make or WSL/bash shell

@github-actions github-actions Bot added Area: Tooling Size: XS The size of the change in this PR is very small labels Jul 5, 2026
@github-actions

github-actions Bot commented Jul 5, 2026

Copy link
Copy Markdown

MemBrowse Memory Report

No memory changes detected for:

scan_dir() checked name_len before assigning it. Directory entries already compute and validate strlen(a_dirent->d_name) before allocating the dir item, while the root path passed to scan_dir() is not encoded as a directory entry name.

Remove the stale pre-opendir check so scan_dir() no longer branches on an uninitialized local variable.

Generated-by: OpenAI Codex
Signed-off-by: aineoae86-sys <ai.neo.ae86@gmail.com>
@Old-Ding Old-Ding force-pushed the codex/rp2040-flashfs-name-len branch from 3aecd4a to 80acd00 Compare July 5, 2026 20:13
@xiaoxiang781216 xiaoxiang781216 merged commit 95e4561 into apache:master Jul 10, 2026
89 of 91 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: Tooling Size: XS The size of the change in this PR is very small

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants