tools: mkcapsule builds warning-free -- the truncations impossible or handled (#143)
The kernel build's only warnings were five -Wformat-truncation in mkcapsule's --resolve: two snprintf copies of a capsule name into the claim registry, and the capsule's path built from base_dir and its name. - The names: both are char[CAPSULE_NAME_MAX], and names are checked to fit when read (line 335) -- copied whole with memcpy, nothing to truncate. - The path: base_dir may be up to 4095 bytes, so it can be cut, and a cut path names another file -- now refused, the capsule left unchanged and counted rejected, with the reason. Seen to fail first: built with -Werror=format-truncation, 5 errors. After: 0, and 0 warnings with the kernel's flags; the manifest it writes is byte-identical, --lint passes. The too-long-path refusal is on --resolve's interactive conflict path and was not driven by a test. CLAUDE.md's count of open warnings corrected. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017RzZgrf7V7Zk2iczBXDRbm
This commit is contained in:
+3
-2
@@ -466,8 +466,9 @@ status for kernel work.
|
||||
`TestCase.contract`/`WordTestSuite.suite_contract` trailing field, ~3,010 instances). Fixed
|
||||
in place across all 20 files (mechanical: added the missing `{0}` initializer, semantically
|
||||
a no-op since C99 already zero-fills unlisted trailing fields — the fix only silences the
|
||||
diagnostic). Verified clean on all three architectures. Remaining, still-open warnings as of 2026-11-10: **5 `-Wformat-truncation`** in
|
||||
`tools/mkcapsule.c` — corrected 2026-11-10; this file said 26 `-Wunused-parameter`,
|
||||
diagnostic). Verified clean on all three architectures. Remaining, still-open warnings: **none** (2026-11-12, #143 -- the
|
||||
5 `-Wformat-truncation` in `tools/mkcapsule.c`, still open on 2026-11-10, are fixed:
|
||||
same-sized name arrays copied whole, a path too long refused instead of cut) — corrected 2026-11-10; this file said 26 `-Wunused-parameter`,
|
||||
2 `-Wsign-compare`, and 2 `-Wstringop-truncation` (the -Wunused-parameter and
|
||||
-Wsign-compare diagnostics were resolved since that audit). `tools/mkcapsule.c` is a
|
||||
host build tool compiled via plain `cc -Wall -Wextra -O2` (no `-Werror`).
|
||||
|
||||
Reference in New Issue
Block a user