Skip to content

Commit 6ea3b34

Browse files
David Laighttytso
authored andcommitted
ext4: fix diagnostic printf formats
The formats for non-terminated names should be "%.*s" not "%*.s". The kernel currently treats "%*.s" as equivalent to "%*s" whereas userspace requires it be equivalent to "%*.0s". Neither is correct here. Signed-off-by: David Laight <david.laight.linux@gmail.com> Link: https://patch.msgid.link/20260326201804.3881-1-david.laight.linux@gmail.com Signed-off-by: Theodore Ts'o <tytso@mit.edu>
1 parent 52b4fea commit 6ea3b34

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

fs/ext4/namei.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -647,7 +647,7 @@ static struct stats dx_show_leaf(struct inode *dir,
647647
/* Directory is not encrypted */
648648
(void) ext4fs_dirhash(dir, de->name,
649649
de->name_len, &h);
650-
printk("%*.s:(U)%x.%u ", len,
650+
printk("%.*s:(U)%x.%u ", len,
651651
name, h.hash,
652652
(unsigned) ((char *) de
653653
- base));
@@ -683,7 +683,7 @@ static struct stats dx_show_leaf(struct inode *dir,
683683
(void) ext4fs_dirhash(dir,
684684
de->name,
685685
de->name_len, &h);
686-
printk("%*.s:(E)%x.%u ", len, name,
686+
printk("%.*s:(E)%x.%u ", len, name,
687687
h.hash, (unsigned) ((char *) de
688688
- base));
689689
fscrypt_fname_free_buffer(
@@ -694,7 +694,7 @@ static struct stats dx_show_leaf(struct inode *dir,
694694
char *name = de->name;
695695
(void) ext4fs_dirhash(dir, de->name,
696696
de->name_len, &h);
697-
printk("%*.s:%x.%u ", len, name, h.hash,
697+
printk("%.*s:%x.%u ", len, name, h.hash,
698698
(unsigned) ((char *) de - base));
699699
#endif
700700
}

0 commit comments

Comments
 (0)