Skip to contentSkip to conversation

f2fs: fix 32-bit format string warning

PATCH In review Arnd Bergmann 3 participants 4 messages Jul 24, 2018 – Jul 27, 2018 F2FS file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 f2fs: fix 32-bit format string warning

On 32-bit targets, size_t is often 'unsigned int', so printing it as %lu causes a warning:

fs/f2fs/inode.c: In function 'sanity_check_inode':
fs/f2fs/inode.c:247:4: error: format '%lu' expects argument of type 'long unsigned int', but argument 7 has type 'unsigned int' [-Werror=format=]

The correct format string is %zu.

Fixes ba3a252d3367 ("f2fs: fix to do sanity check with i_extra_isize")
---
 fs/f2fs/inode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/f2fs/inode.c +1 -1
index 3fe63b0c7325..4fd339fd3ff2 100644
@@ -245,7 +245,7 @@ static bool sanity_check_inode(struct inode *inode, struct page *node_page)
 		set_sbi_flag(sbi, SBI_NEED_FSCK);
 		f2fs_msg(sbi->sb, KERN_WARNING,
 			"%s: inode (ino=%lx) has corrupted i_extra_isize: %d, "
-			"max: %lu",
+			"max: %zu",
 			__func__, inode->i_ino, fi->i_extra_isize,
 			F2FS_TOTAL_EXTRA_ATTR_SIZE);
 		return false;
Signature · 6 lines
2.18.0


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
maintainer
#1 lore raw
Quoted 10 lines · Arnd Bergmann

On 32-bit targets, size_t is often 'unsigned int', so printing it as %lu causes a warning:

fs/f2fs/inode.c: In function 'sanity_check_inode':
fs/f2fs/inode.c:247:4: error: format '%lu' expects argument of type 'long unsigned int', but argument 7 has type 'unsigned int' [-Werror=format=]

The correct format string is %zu.

Fixes ba3a252d3367 ("f2fs: fix to do sanity check with i_extra_isize")

I noticed the issue, thank you for fixing it, but original buggy patch has not been upstreamed yet, how about merging this fix into origial patch, if you don't mind?

Thanks,

Quoted 18 lines
---
 fs/f2fs/inode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/f2fs/inode.c +1 -1
index 3fe63b0c7325..4fd339fd3ff2 100644
@@ -245,7 +245,7 @@ static bool sanity_check_inode(struct inode *inode, struct page *node_page)
 		set_sbi_flag(sbi, SBI_NEED_FSCK);
 		f2fs_msg(sbi->sb, KERN_WARNING,
 			"%s: inode (ino=%lx) has corrupted i_extra_isize: %d, "
-			"max: %lu",
+			"max: %zu",
 			__func__, inode->i_ino, fi->i_extra_isize,
 			F2FS_TOTAL_EXTRA_ATTR_SIZE);
 		return false;
#2 lore raw
Quoted 7 lines · Chao Yu
Quoted 6 lines · Arnd Bergmann

On 32-bit targets, size_t is often 'unsigned int', so printing it as %lu causes a warning:

fs/f2fs/inode.c: In function 'sanity_check_inode':
fs/f2fs/inode.c:247:4: error: format '%lu' expects argument of type 'long unsigned int', but argument 7 has type 'unsigned int' [-Werror=format=]

Quoted 8 lines
Quoted 4 lines

The correct format string is %zu.

Fixes ba3a252d3367 ("f2fs: fix to do sanity check with i_extra_isize")

I noticed the issue, thank you for fixing it, but original buggy patch has not been upstreamed yet, how about merging this fix into origial patch, if you don't mind?

Yes, please do that.

Arnd

maintainer
#3 lore raw
Quoted 10 lines · Arnd Bergmann
Quoted 9 lines · Chao Yu
Quoted 8 lines · Arnd Bergmann

On 32-bit targets, size_t is often 'unsigned int', so printing it as %lu causes a warning:

fs/f2fs/inode.c: In function 'sanity_check_inode':
fs/f2fs/inode.c:247:4: error: format '%lu' expects argument of type 'long unsigned int', but argument 7 has type 'unsigned int' [-Werror=format=]

The correct format string is %zu.

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
Fixes ba3a252d3367 ("f2fs: fix to do sanity check with i_extra_isize")

I noticed the issue, thank you for fixing it, but original buggy patch has not been upstreamed yet, how about merging this fix into origial patch, if you don't mind?

Yes, please do that.

Squashed.
Thank you.

Quoted 2 lines

Arnd