summaryrefslogtreecommitdiff
path: root/super1.c
diff options
context:
space:
mode:
authorMariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>2022-01-20 13:18:33 +0100
committerJes Sorensen <jsorensen@fb.com>2022-04-04 21:29:43 -0400
commit5f21d67472ad08c1e96b4385254adba79aa1c467 (patch)
tree10144774aa470f040ff41e750eab055a94e3c137 /super1.c
parent913f07d1db4a0078acc26d6ccabe1c315cf9273c (diff)
downloadmdadm-5f21d67472ad08c1e96b4385254adba79aa1c467.tar.gz
mdadm: add map_num_s()
map_num() returns NULL if key is not defined. This patch adds alternative, non NULL version for cases where NULL is not expected. There are many printf() calls where map_num() is called on variable without NULL verification. It works, even if NULL is passed because gcc is able to ignore NULL argument quietly but the behavior is undefined. For safety reasons such usages will use map_num_s() now. It is a potential point of regression. Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
Diffstat (limited to 'super1.c')
-rw-r--r--super1.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/super1.c b/super1.c
index a12a5bc..e3e2f95 100644
--- a/super1.c
+++ b/super1.c
@@ -671,7 +671,7 @@ static void export_examine_super1(struct supertype *st)
int len = 32;
int layout;
- printf("MD_LEVEL=%s\n", map_num(pers, __le32_to_cpu(sb->level)));
+ printf("MD_LEVEL=%s\n", map_num_s(pers, __le32_to_cpu(sb->level)));
printf("MD_DEVICES=%d\n", __le32_to_cpu(sb->raid_disks));
for (i = 0; i < 32; i++)
if (sb->set_name[i] == '\n' || sb->set_name[i] == '\0') {