Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

btrfs: print-tree: use string format for key names

There's a warning when -Wformat=2 is used:

fs/btrfs/print-tree.c: In function ‘key_type_string’:
fs/btrfs/print-tree.c:424:17: warning: format not a string literal and no format arguments [-Wformat-nonliteral]
424 | scnprintf(buf, buf_size, key_to_str[key->type]);

We're printing fixed strings from a table so there's no problem but
let's fix the warning so we could enable the warning in fs/btrfs/.

Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: David Sterba <dsterba@suse.com>

+1 -1
+1 -1
fs/btrfs/print-tree.c
··· 421 421 if (key->type == 0 && key->objectid == BTRFS_FREE_SPACE_OBJECTID) 422 422 scnprintf(buf, buf_size, "UNTYPED"); 423 423 else if (key_to_str[key->type]) 424 - scnprintf(buf, buf_size, key_to_str[key->type]); 424 + scnprintf(buf, buf_size, "%s", key_to_str[key->type]); 425 425 else 426 426 scnprintf(buf, buf_size, "UNKNOWN.%d", key->type); 427 427 }