* [PATCH] btrfs: fix size_t format string
@ 2018-07-17 13:52 Arnd Bergmann
2018-07-17 14:33 ` Qu Wenruo
2018-07-17 15:04 ` David Sterba
0 siblings, 2 replies; 8+ messages in thread
From: Arnd Bergmann @ 2018-07-17 13:52 UTC (permalink / raw)
To: Chris Mason, Josef Bacik, David Sterba
Cc: Arnd Bergmann, Qu Wenruo, Nikolay Borisov, Su Yue, linux-btrfs,
linux-kernel
The newly added check_block_group_item() function causes a build warning
on 32-bit architectures:
fs/btrfs/tree-checker.c: In function 'check_block_group_item':
fs/btrfs/tree-checker.c:404:41: error: format '%lu' expects argument of type 'long unsigned int', but argument 6 has type 'unsigned int' [-Werror=format=]
The type of a sizeof() expression is size_t, which is correctly printed
using the %zu format string.
Fixes: 9dc16aad5660 ("btrfs: tree-checker: Verify block_group_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 e9414c3f375e..4c82a628df85 100644
--- a/fs/btrfs/tree-checker.c
+++ b/fs/btrfs/tree-checker.c
@@ -401,7 +401,7 @@ static int check_block_group_item(struct btrfs_fs_info *fs_info,
if (item_size != sizeof(bgi)) {
block_group_err(fs_info, leaf, slot,
- "invalid item size, have %u expect %lu",
+ "invalid item size, have %u expect %zu",
item_size, sizeof(bgi));
return -EUCLEAN;
}
--
2.9.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] btrfs: fix size_t format string
2018-07-17 13:52 [PATCH] btrfs: fix size_t format string Arnd Bergmann
@ 2018-07-17 14:33 ` Qu Wenruo
2018-07-17 16:02 ` Arnd Bergmann
2018-07-17 15:04 ` David Sterba
1 sibling, 1 reply; 8+ messages in thread
From: Qu Wenruo @ 2018-07-17 14:33 UTC (permalink / raw)
To: Arnd Bergmann, Chris Mason, Josef Bacik, David Sterba
Cc: Qu Wenruo, Nikolay Borisov, Su Yue, linux-btrfs, linux-kernel
On 2018年07月17日 21:52, Arnd Bergmann wrote:
> The newly added check_block_group_item() function causes a build warning
> on 32-bit architectures:
>
> fs/btrfs/tree-checker.c: In function 'check_block_group_item':
> fs/btrfs/tree-checker.c:404:41: error: format '%lu' expects argument of type 'long unsigned int', but argument 6 has type 'unsigned int' [-Werror=format=]
>
> The type of a sizeof() expression is size_t, which is correctly printed
> using the %zu format string.
>
> Fixes: 9dc16aad5660 ("btrfs: tree-checker: Verify block_group_item")
My fault again. :(
Is there anyway to make gcc report such problem even under x86_64?
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Thanks,
Qu
> ---
> 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 e9414c3f375e..4c82a628df85 100644
> --- a/fs/btrfs/tree-checker.c
> +++ b/fs/btrfs/tree-checker.c
> @@ -401,7 +401,7 @@ static int check_block_group_item(struct btrfs_fs_info *fs_info,
>
> if (item_size != sizeof(bgi)) {
> block_group_err(fs_info, leaf, slot,
> - "invalid item size, have %u expect %lu",
> + "invalid item size, have %u expect %zu",
> item_size, sizeof(bgi));
> return -EUCLEAN;
> }
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] btrfs: fix size_t format string
2018-07-17 13:52 [PATCH] btrfs: fix size_t format string Arnd Bergmann
2018-07-17 14:33 ` Qu Wenruo
@ 2018-07-17 15:04 ` David Sterba
2018-07-23 17:07 ` Randy Dunlap
1 sibling, 1 reply; 8+ messages in thread
From: David Sterba @ 2018-07-17 15:04 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Chris Mason, Josef Bacik, David Sterba, Qu Wenruo,
Nikolay Borisov, Su Yue, linux-btrfs, linux-kernel
On Tue, Jul 17, 2018 at 03:52:27PM +0200, Arnd Bergmann wrote:
> The newly added check_block_group_item() function causes a build warning
> on 32-bit architectures:
>
> fs/btrfs/tree-checker.c: In function 'check_block_group_item':
> fs/btrfs/tree-checker.c:404:41: error: format '%lu' expects argument of type 'long unsigned int', but argument 6 has type 'unsigned int' [-Werror=format=]
>
> The type of a sizeof() expression is size_t, which is correctly printed
> using the %zu format string.
>
> Fixes: 9dc16aad5660 ("btrfs: tree-checker: Verify block_group_item")
Folded to the commit, thanks.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] btrfs: fix size_t format string
2018-07-17 14:33 ` Qu Wenruo
@ 2018-07-17 16:02 ` Arnd Bergmann
0 siblings, 0 replies; 8+ messages in thread
From: Arnd Bergmann @ 2018-07-17 16:02 UTC (permalink / raw)
To: Qu Wenruo
Cc: Chris Mason, Josef Bacik, David Sterba, Qu Wenruo,
Nikolay Borisov, Su Yue, linux-btrfs, Linux Kernel Mailing List
On Tue, Jul 17, 2018 at 4:33 PM, Qu Wenruo <quwenruo.btrfs@gmx.com> wrote:
>
>
> On 2018年07月17日 21:52, Arnd Bergmann wrote:
>> The newly added check_block_group_item() function causes a build warning
>> on 32-bit architectures:
>>
>> fs/btrfs/tree-checker.c: In function 'check_block_group_item':
>> fs/btrfs/tree-checker.c:404:41: error: format '%lu' expects argument of type 'long unsigned int', but argument 6 has type 'unsigned int' [-Werror=format=]
>>
>> The type of a sizeof() expression is size_t, which is correctly printed
>> using the %zu format string.
>>
>> Fixes: 9dc16aad5660 ("btrfs: tree-checker: Verify block_group_item")
>
> My fault again. :(
>
> Is there anyway to make gcc report such problem even under x86_64?
I don't think so. However, if you post a patch to the mainling list, the
0-day bot should report any build regressions within a day.
Arnd
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] btrfs: fix size_t format string
2018-07-17 15:04 ` David Sterba
@ 2018-07-23 17:07 ` Randy Dunlap
2018-07-24 8:19 ` David Sterba
0 siblings, 1 reply; 8+ messages in thread
From: Randy Dunlap @ 2018-07-23 17:07 UTC (permalink / raw)
To: dsterba, Arnd Bergmann, Chris Mason, Josef Bacik, David Sterba,
Qu Wenruo, Nikolay Borisov, Su Yue, linux-btrfs, linux-kernel
On 07/17/2018 08:04 AM, David Sterba wrote:
> On Tue, Jul 17, 2018 at 03:52:27PM +0200, Arnd Bergmann wrote:
>> The newly added check_block_group_item() function causes a build warning
>> on 32-bit architectures:
>>
>> fs/btrfs/tree-checker.c: In function 'check_block_group_item':
>> fs/btrfs/tree-checker.c:404:41: error: format '%lu' expects argument of type 'long unsigned int', but argument 6 has type 'unsigned int' [-Werror=format=]
>>
>> The type of a sizeof() expression is size_t, which is correctly printed
>> using the %zu format string.
>>
>> Fixes: 9dc16aad5660 ("btrfs: tree-checker: Verify block_group_item")
>
> Folded to the commit, thanks.
>
Hi David,
Where did this patch end up? linux-next-20180723 is still showing this
format warning.
thanks,
--
~Randy
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] btrfs: fix size_t format string
2018-07-23 17:07 ` Randy Dunlap
@ 2018-07-24 8:19 ` David Sterba
0 siblings, 0 replies; 8+ messages in thread
From: David Sterba @ 2018-07-24 8:19 UTC (permalink / raw)
To: Randy Dunlap
Cc: dsterba, Arnd Bergmann, Chris Mason, Josef Bacik, David Sterba,
Qu Wenruo, Nikolay Borisov, Su Yue, linux-btrfs, linux-kernel
On Mon, Jul 23, 2018 at 10:07:42AM -0700, Randy Dunlap wrote:
> On 07/17/2018 08:04 AM, David Sterba wrote:
> > On Tue, Jul 17, 2018 at 03:52:27PM +0200, Arnd Bergmann wrote:
> >> The newly added check_block_group_item() function causes a build warning
> >> on 32-bit architectures:
> >>
> >> fs/btrfs/tree-checker.c: In function 'check_block_group_item':
> >> fs/btrfs/tree-checker.c:404:41: error: format '%lu' expects argument of type 'long unsigned int', but argument 6 has type 'unsigned int' [-Werror=format=]
> >>
> >> The type of a sizeof() expression is size_t, which is correctly printed
> >> using the %zu format string.
> >>
> >> Fixes: 9dc16aad5660 ("btrfs: tree-checker: Verify block_group_item")
> >
> > Folded to the commit, thanks.
> >
>
> Hi David,
> Where did this patch end up? linux-next-20180723 is still showing this
> format warning.
It's still in a local branch, I haven't pushed for-next for a few days
but will do today.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] btrfs: fix size_t format string
2015-03-09 11:39 Arnd Bergmann
@ 2015-03-09 11:49 ` David Sterba
0 siblings, 0 replies; 8+ messages in thread
From: David Sterba @ 2015-03-09 11:49 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Chris Mason, David Sterba, linux-btrfs, Josef Bacik,
linux-kernel, linux-arm-kernel
On Mon, Mar 09, 2015 at 12:39:36PM +0100, Arnd Bergmann wrote:
> This warning has been rather annoying because it shows up in every
> 'allmodconfig' build. I assume others have reported it before, but
> please apply some fix for it, ideally before 4.0.
Sorry about that, we're aware of the warning and Chris will push the
patch to the next rc.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH] btrfs: fix size_t format string
@ 2015-03-09 11:39 Arnd Bergmann
2015-03-09 11:49 ` David Sterba
0 siblings, 1 reply; 8+ messages in thread
From: Arnd Bergmann @ 2015-03-09 11:39 UTC (permalink / raw)
To: Chris Mason
Cc: David Sterba, linux-btrfs, Josef Bacik, linux-kernel, linux-arm-kernel
This resolves a harmless gcc warning in btrfs_check_super_valid that
results from a size_t value being printed as %lu:
fs/btrfs/disk-io.c:3927:21: warning: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'unsigned int' [-Wformat=]
On all Linux systems, size_t is the same length as unsigned long,
but the compiler does not know this, and warns about potentially
unportable code here. The correct printf string for size_t is %z.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: ce7fca5f57ed0f "btrfs: add checks for sys_chunk_array sizes"
Cc: David Sterba <dsterba@suse.cz>
Cc: Chris Mason <clm@fb.com>
---
This warning has been rather annoying because it shows up in every
'allmodconfig' build. I assume others have reported it before, but
please apply some fix for it, ideally before 4.0.
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index f79f38542a73..639f2663ed3f 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -3921,7 +3921,7 @@ static int btrfs_check_super_valid(struct btrfs_fs_info *fs_info,
}
if (btrfs_super_sys_array_size(sb) < sizeof(struct btrfs_disk_key)
+ sizeof(struct btrfs_chunk)) {
- printk(KERN_ERR "BTRFS: system chunk array too small %u < %lu\n",
+ printk(KERN_ERR "BTRFS: system chunk array too small %u < %zu\n",
btrfs_super_sys_array_size(sb),
sizeof(struct btrfs_disk_key)
+ sizeof(struct btrfs_chunk));
^ permalink raw reply related [flat|nested] 8+ messages in thread
end of thread, other threads:[~2018-07-24 8:19 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-17 13:52 [PATCH] btrfs: fix size_t format string Arnd Bergmann
2018-07-17 14:33 ` Qu Wenruo
2018-07-17 16:02 ` Arnd Bergmann
2018-07-17 15:04 ` David Sterba
2018-07-23 17:07 ` Randy Dunlap
2018-07-24 8:19 ` David Sterba
-- strict thread matches above, loose matches on Subject: below --
2015-03-09 11:39 Arnd Bergmann
2015-03-09 11:49 ` David Sterba
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).