Re: [PATCH] btrfs: tree-checker: use %zu format string for size_t
On Thu, Dec 07, 2017 at 08:32:04AM +0800, Qu Wenruo wrote: > > > On 2017年12月06日 22:18, Arnd Bergmann wrote: > > 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=] > > Any idea about which architecture will cause such warning? > On x86_64 I always fail to get such warning. The intel 0-day build bot compiles on various architectures and 32/64 setups, I'm not sure if this warning has been reported, no such mail in my mboxes.
Re: [PATCH] btrfs: tree-checker: use %zu format string for size_t
On Thu, Dec 07, 2017 at 08:32:04AM +0800, Qu Wenruo wrote: > > > On 2017年12月06日 22:18, Arnd Bergmann wrote: > > 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=] > > Any idea about which architecture will cause such warning? > On x86_64 I always fail to get such warning. The intel 0-day build bot compiles on various architectures and 32/64 setups, I'm not sure if this warning has been reported, no such mail in my mboxes.
Re: [PATCH] btrfs: tree-checker: use %zu format string for size_t
On Thu, Dec 7, 2017 at 1:32 AM, Qu Wenruowrote: > > > On 2017年12月06日 22:18, Arnd Bergmann wrote: >> 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=] > > Any idea about which architecture will cause such warning? > On x86_64 I always fail to get such warning. I think all 32-bit architectures: #ifndef __kernel_size_t #if __BITS_PER_LONG != 64 typedef unsigned int__kernel_size_t; typedef int __kernel_ssize_t; typedef int __kernel_ptrdiff_t; #else typedef __kernel_ulong_t __kernel_size_t; typedef __kernel_long_t __kernel_ssize_t; typedef __kernel_long_t __kernel_ptrdiff_t; #endif #endif Arnd
Re: [PATCH] btrfs: tree-checker: use %zu format string for size_t
On Thu, Dec 7, 2017 at 1:32 AM, Qu Wenruo wrote: > > > On 2017年12月06日 22:18, Arnd Bergmann wrote: >> 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=] > > Any idea about which architecture will cause such warning? > On x86_64 I always fail to get such warning. I think all 32-bit architectures: #ifndef __kernel_size_t #if __BITS_PER_LONG != 64 typedef unsigned int__kernel_size_t; typedef int __kernel_ssize_t; typedef int __kernel_ptrdiff_t; #else typedef __kernel_ulong_t __kernel_size_t; typedef __kernel_long_t __kernel_ssize_t; typedef __kernel_long_t __kernel_ptrdiff_t; #endif #endif Arnd
Re: [PATCH] btrfs: tree-checker: use %zu format string for size_t
On 2017年12月06日 22:18, Arnd Bergmann wrote: > 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=] Any idea about which architecture will cause such warning? On x86_64 I always fail to get such warning. > > Fixes: 005887f2e3e0 ("btrfs: tree-checker: Add checker for dir item") Reviewed-by: Qu WenruoThanks, Qu > Signed-off-by: Arnd Bergmann > --- > 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; > } > signature.asc Description: OpenPGP digital signature
Re: [PATCH] btrfs: tree-checker: use %zu format string for size_t
On 2017年12月06日 22:18, Arnd Bergmann wrote: > 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=] Any idea about which architecture will cause such warning? On x86_64 I always fail to get such warning. > > Fixes: 005887f2e3e0 ("btrfs: tree-checker: Add checker for dir item") Reviewed-by: Qu Wenruo Thanks, Qu > Signed-off-by: Arnd Bergmann > --- > 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; > } > signature.asc Description: OpenPGP digital signature
Re: [PATCH] btrfs: tree-checker: use %zu format string for size_t
On Wed, Dec 06, 2017 at 03:18:14PM +0100, Arnd Bergmann wrote: > 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 BergmannReviewed-by: David Sterba
Re: [PATCH] btrfs: tree-checker: use %zu format string for size_t
On Wed, Dec 06, 2017 at 03:18:14PM +0100, Arnd Bergmann wrote: > 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 Reviewed-by: David Sterba
[PATCH] btrfs: tree-checker: use %zu format string for size_t
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--- 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
[PATCH] btrfs: tree-checker: use %zu format string for size_t
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 --- 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
Re: [PATCH] btrfs: tree-checker: use %zu format string for size_t
On Fri, Oct 13, 2017 at 11:27:35AM +0200, Arnd Bergmann wrote: > 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 BergmannReviewed-by: David Sterba
Re: [PATCH] btrfs: tree-checker: use %zu format string for size_t
On Fri, Oct 13, 2017 at 11:27:35AM +0200, Arnd Bergmann wrote: > 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 Reviewed-by: David Sterba
[PATCH] btrfs: tree-checker: use %zu format string for size_t
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--- 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
[PATCH] btrfs: tree-checker: use %zu format string for size_t
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 --- 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