Re: [PATCH next 1/2] btrfs: tree-checker: Fix error format string
From: David Sterba
Date: Mon Nov 11 2019 - 13:31:59 EST
On Fri, Nov 08, 2019 at 10:38:52PM +0100, Andreas Färber wrote:
> From: Andreas Färber <afaerber@xxxxxxxx>
>
> Argument BTRFS_FILE_EXTENT_INLINE_DATA_START is defined as offsetof(),
> which returns type size_t, so we need %zu instead of %lu.
>
> This fixes a build warning on 32-bit arm:
>
> ../fs/btrfs/tree-checker.c: In function 'check_extent_data_item':
> ../fs/btrfs/tree-checker.c:230:43: warning: format '%lu' expects argument of type 'long unsigned int', but argument 5 has type 'unsigned int' [-Wformat=]
> 230 | "invalid item size, have %u expect [%lu, %u)",
> | ~~^
> | |
> | long unsigned int
> | %u
Is there a gcc warning option that can catch that on 64bit too?
-Wformat=2 does not and I don't see any other of the option family to do
that. We've had fixups of the size_t printk formats and I'd like to
catch that when the patches are added to the devel branches. I can't run
32bit build check each time but this seems to be the only way so far.
> Fixes: a31ccb4b7ba2 ("btrfs: tree-checker: Check item size before reading file extent type")
As the patch is still in the devel branch, the commit id is not stable
and I'll fold the change to to the patch. Thanks.