linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: Arnd Bergmann <arnd@arndb.de>, Chris Mason <clm@fb.com>,
	Josef Bacik <jbacik@fb.com>, David Sterba <dsterba@suse.com>
Cc: Qu Wenruo <wqu@suse.com>, Nikolay Borisov <nborisov@suse.com>,
	Su Yue <suy.fnst@cn.fujitsu.com>,
	linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] btrfs: fix size_t format string
Date: Tue, 17 Jul 2018 22:33:07 +0800	[thread overview]
Message-ID: <dbbb1882-65bf-dda9-eb26-a6217b240def@gmx.com> (raw)
In-Reply-To: <20180717135236.3673195-1-arnd@arndb.de>



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;
>  	}
> 

  reply	other threads:[~2018-07-17 15:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-17 13:52 [PATCH] btrfs: fix size_t format string Arnd Bergmann
2018-07-17 14:33 ` Qu Wenruo [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=dbbb1882-65bf-dda9-eb26-a6217b240def@gmx.com \
    --to=quwenruo.btrfs@gmx.com \
    --cc=arnd@arndb.de \
    --cc=clm@fb.com \
    --cc=dsterba@suse.com \
    --cc=jbacik@fb.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nborisov@suse.com \
    --cc=suy.fnst@cn.fujitsu.com \
    --cc=wqu@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).