From 5f21d67472ad08c1e96b4385254adba79aa1c467 Mon Sep 17 00:00:00 2001 From: Mariusz Tkaczyk Date: Thu, 20 Jan 2022 13:18:33 +0100 Subject: 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 Signed-off-by: Jes Sorensen --- Create.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Create.c') diff --git a/Create.c b/Create.c index 9ea19de0..c84c1ac8 100644 --- a/Create.c +++ b/Create.c @@ -83,7 +83,7 @@ int default_layout(struct supertype *st, int level, int verbose) if (layout_map) { layout = map_name(layout_map, "default"); - layout_name = map_num(layout_map, layout); + layout_name = map_num_s(layout_map, layout); } if (layout_name && verbose > 0) pr_err("layout defaults to %s\n", layout_name); -- cgit v1.2.3