Repository navigation
fs/inode: build the foreach_inode() path without snprintf() - #22166
Merged
xiaoxiang781216 merged 1 commit intoNov 23, 2026
Merged
Conversation
foreach_inodelevel() appended each path segment with snprintf("/%s").
sync() walks the mountpoints and is always linked through the reboot
notifier, so images that do not otherwise use printf now link the
whole printf engine. Copy the segment with strlcpy() instead; the
length is already checked against PATH_MAX.
Signed-off-by: jingfei <[email protected]>
jingfei195887
requested review from
Donny9,
anchao and
xiaoxiang781216
as code owners
November 23, 2026 03:17
4 of 5 tasks
|
xiaoxiang781216
approved these changes
Nov 23, 2026
GUIDINGLI
approved these changes
Nov 23, 2026
casaroli
approved these changes
Nov 23, 2026
1 task done
1 task done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
foreach_inodelevel()appended each path segment withsnprintf("/%s"). Since fs/vfs: sync mounted filesystems in sync() #21999,sync()walks the mountpoints withforeach_inode(), andsync()is always linked through the rebootnotifier (
fs_reboot_initialize()), so an image that does not otherwiseuse printf now links the whole printf engine. Copy the segment with
strlcpy()instead; the length is already checked againstPATH_MAX.Reported by @raiden00pl in #21999 (comment) (size of minimal images).
Impact
Testing
Host: Ubuntu 22.04 x86_64, arm-none-eabi-gcc 10.3.1 and 13.2.1.
Base: master b2b0bde. Flash = text + data.
nucleo-f302r8:nshreduced to a minimal image:CONFIG_DEFAULT_SMALL=y,CONFIG_LTO_FULL=y,CONFIG_INIT_NONE=y, no USART/console/syslogchannel, no
/devnodes, no procfs/romfs/tmpfs. "revert" is master with#21999 and #22046 reverted.
CONFIG_DISABLE_MOUNTPOINT=yThis PR removes the printf engine (
snprintf,__udivmoddi4and thestream helpers, about 2.4 KB). The remaining ~1 KB is the mountpoint walk
itself (
sync()inlined into the reboot handler,foreach_inodelevel(),mountpt_syncfs());CONFIG_DISABLE_MOUNTPOINT=yremoves it.sim:nshwith tmpfs mounts at/x1/y2/z3and/t1:cat /proc/fs/mountand
umount_all()give the same output before and after../tools/checkpatch.sh -g master..HEAD: all checks pass.sim:nshMake and CMake builds pass with no warnings in the changedfile;
ostestexits with status 0.PR verification Self-Check