Skip to contentSkip to conversation

btrfs: fix static checker warnings

PATCH In review Jeff Mahoney 2 participants 2 messages Nov 20, 2013 Btrfs file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 btrfs: fix static checker warnings

This patch fixes the following warnings:
fs/btrfs/extent-tree.c:6201:12: sparse: symbol 'get_raid_name' was not declared. Should it be static? fs/btrfs/extent-tree.c:8430:9: error: format not a string literal and no format arguments [-Werror=format-security] get_raid_name(index));

---
 fs/btrfs/extent-tree.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
fs/btrfs/extent-tree.c +2 -2
@@ -6119,7 +6119,7 @@ static const char *btrfs_raid_type_names
 	[BTRFS_RAID_RAID6]	= "raid6",
 };
 
-const char *get_raid_name(enum btrfs_raid_types type)
+static const char *get_raid_name(enum btrfs_raid_types type)
 {
 	if (type >= BTRFS_NR_RAID_TYPES)
 		return NULL;
@@ -8328,7 +8328,7 @@ static void __link_block_group(struct bt
 
 		kobject_get(&space_info->kobj); /* put in release */
 		ret = kobject_init_and_add(kobj, &btrfs_raid_ktype,
-					   &space_info->kobj,
+					   &space_info->kobj, "%s",
 					   get_raid_name(index));
 		if (ret) {
 			pr_warn("btrfs: failed to add kobject for block cache. ignoring.\n");
Signature · 2 lines
Jeff Mahoney
SUSE Labs
Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Jeff Mahoney

This patch fixes the following warnings:
fs/btrfs/extent-tree.c:6201:12: sparse: symbol 'get_raid_name' was not declared. Should it be static? fs/btrfs/extent-tree.c:8430:9: error: format not a string literal and no format arguments [-Werror=format-security] get_raid_name(index));

Thanks!

-Kees

Signature · 2 lines
Kees Cook
Chrome OS Security