[PATCH 2/9] fs: qemu_fw_cfg: report symlink target length as st_size

Sascha Hauer s.hauer at pengutronix.de
Tue Oct 20 00:09:27 PDT 2026


The by_name/ entries are symlinks into by_key/, but their inodes are
left with i_size 0, so 'ls -l' and lstat() report a size of 0 for them.
Set i_size to the length of the link target, as other filesystems do.

Replacing the leading spaces with "../" afterwards does not change the
length of the target, so it is safe to take it right away.

Fixes: 050ea5bb93 ("fs: add qemu_fw_cfg file system")
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 fs/qemu_fw_cfg.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/qemu_fw_cfg.c b/fs/qemu_fw_cfg.c
index d0414b127c..fd16c09239 100644
--- a/fs/qemu_fw_cfg.c
+++ b/fs/qemu_fw_cfg.c
@@ -241,6 +241,7 @@ static int fw_cfg_fs_parse(struct super_block *sb)
 						    (ndirs + 1) * 3, "", buf);
 
 				parent->inode.i_link = s;
+				parent->inode.i_size = strlen(s);
 				while (*s == ' ')
 					s = mempcpy(s, "../", 3);
 			}

-- 
2.47.3




More information about the barebox mailing list