All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] btrfs: tree-checker: use %zu format string for size_t
@ 2017-10-13  9:27 Arnd Bergmann
  2017-10-13 12:06 ` David Sterba
  0 siblings, 1 reply; 7+ messages in thread
From: Arnd Bergmann @ 2017-10-13  9:27 UTC (permalink / raw)
  To: Chris Mason, Josef Bacik, David Sterba
  Cc: Arnd Bergmann, Qu Wenruo, linux-btrfs, linux-kernel

We now get a harmless compile-time on 32-bit architectures:

fs/btrfs/tree-checker.c: In function 'check_extent_data_item':
fs/btrfs/tree-checker.c:189:70: error: format '%lu' expects argument of type 'long unsigned int', but argument 6 has type 'unsigned int' [-Werror=format=]

This changes the format string to use %zu instead of %lu for size_t.

Fixes: c1f6520bf360 ("btrfs: tree-checker: Enhance output for check_extent_data_item")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 fs/btrfs/tree-checker.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/btrfs/tree-checker.c b/fs/btrfs/tree-checker.c
index c7a09cc2a17c..388fb6553aa5 100644
--- a/fs/btrfs/tree-checker.c
+++ b/fs/btrfs/tree-checker.c
@@ -186,7 +186,7 @@ static int check_extent_data_item(struct btrfs_root *root,
 	/* Regular or preallocated extent has fixed item size */
 	if (item_size != sizeof(*fi)) {
 		file_extent_err(root, leaf, slot,
-			"invalid item size for reg/prealloc file extent, have %u expect %lu",
+			"invalid item size for reg/prealloc file extent, have %u expect %zu",
 			item_size, sizeof(*fi));
 		return -EUCLEAN;
 	}
-- 
2.9.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread
* [PATCH] btrfs: tree-checker: use %zu format string for size_t
@ 2017-12-06 14:18 Arnd Bergmann
  2017-12-06 14:23 ` David Sterba
  2017-12-07  0:32 ` Qu Wenruo
  0 siblings, 2 replies; 7+ messages in thread
From: Arnd Bergmann @ 2017-12-06 14:18 UTC (permalink / raw)
  To: Chris Mason, Josef Bacik, David Sterba
  Cc: Arnd Bergmann, Qu Wenruo, Su Yue, Nikolay Borisov, linux-btrfs,
	linux-kernel

The return value of sizeof() is of type size_t, so we must print it
using the %z format modifier rather than %l to avoid this warning
on some architectures:

fs/btrfs/tree-checker.c: In function 'check_dir_item':
fs/btrfs/tree-checker.c:273:50: error: format '%lu' expects argument of type 'long unsigned int', but argument 5 has type 'u32' {aka 'unsigned int'} [-Werror=format=]

Fixes: 005887f2e3e0 ("btrfs: tree-checker: Add checker for dir item")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 fs/btrfs/tree-checker.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/btrfs/tree-checker.c b/fs/btrfs/tree-checker.c
index 66dac0a4b01f..7c55e3ba5a6c 100644
--- a/fs/btrfs/tree-checker.c
+++ b/fs/btrfs/tree-checker.c
@@ -270,7 +270,7 @@ static int check_dir_item(struct btrfs_root *root,
 		/* header itself should not cross item boundary */
 		if (cur + sizeof(*di) > item_size) {
 			dir_item_err(root, leaf, slot,
-		"dir item header crosses item boundary, have %lu boundary %u",
+		"dir item header crosses item boundary, have %zu boundary %u",
 				cur + sizeof(*di), item_size);
 			return -EUCLEAN;
 		}
-- 
2.9.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-12-07 15:10 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-13  9:27 [PATCH] btrfs: tree-checker: use %zu format string for size_t Arnd Bergmann
2017-10-13 12:06 ` David Sterba
2017-12-06 14:18 Arnd Bergmann
2017-12-06 14:23 ` David Sterba
2017-12-07  0:32 ` Qu Wenruo
2017-12-07  9:06   ` Arnd Bergmann
2017-12-07 15:08   ` David Sterba

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.