diff options
author | Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com> | 2022-01-20 13:18:33 +0100 |
---|---|---|
committer | Jes Sorensen <jsorensen@fb.com> | 2022-04-05 03:29:43 +0200 |
commit | 5f21d67472ad08c1e96b4385254adba79aa1c467 (patch) | |
tree | 10144774aa470f040ff41e750eab055a94e3c137 /mdadm.h | |
parent | Create, Build: use default_layout() (diff) | |
download | mdadm-5f21d67472ad08c1e96b4385254adba79aa1c467.tar.xz mdadm-5f21d67472ad08c1e96b4385254adba79aa1c467.zip |
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 'mdadm.h')
-rw-r--r-- | mdadm.h | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -770,7 +770,7 @@ extern int restore_stripes(int *dest, unsigned long long *offsets, #endif #define SYSLOG_FACILITY LOG_DAEMON - +extern char *map_num_s(mapping_t *map, int num); extern char *map_num(mapping_t *map, int num); extern int map_name(mapping_t *map, char *name); extern mapping_t r0layout[], r5layout[], r6layout[], |