]> git.ipfire.org Git - thirdparty/mdadm.git/commit - super1.c
mdadm: add map_num_s()
authorMariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
Thu, 20 Jan 2022 12:18:33 +0000 (13:18 +0100)
committerJes Sorensen <jsorensen@fb.com>
Tue, 5 Apr 2022 01:29:43 +0000 (21:29 -0400)
commit5f21d67472ad08c1e96b4385254adba79aa1c467
tree10144774aa470f040ff41e750eab055a94e3c137
parent913f07d1db4a0078acc26d6ccabe1c315cf9273c
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>
13 files changed:
Assemble.c
Create.c
Detail.c
Grow.c
Query.c
maps.c
mdadm.c
mdadm.h
super-ddf.c
super-intel.c
super0.c
super1.c
sysfs.c