diff mbox

btrfs: fix size_t format string

Message ID 2448187.keuqSF9F23@wuerfel (mailing list archive)
State New, archived
Headers show

Commit Message

Arnd Bergmann March 9, 2015, 11:39 a.m. UTC
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.


--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

David Sterba March 9, 2015, 11:49 a.m. UTC | #1
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.
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

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