tools: rp2040: Drop uninitialized name length check

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>
This commit is contained in:
aineoae86-sys 2026-07-06 04:05:05 +08:00 committed by Xiang Xiao
parent 1369a2875d
commit 95e4561145

View file

@ -237,12 +237,6 @@ int scan_dir(int in_sector)
struct stat stat;
int name_len;
if (name_len > max_name_len)
{
fprintf(stderr, "directory name to big. skipped. (%s)\n", path);
return -1;
}
input_dir = opendir(path);
if (input_dir == NULL)