From: Colin Walters Date: Fri, 14 Jul 2023 10:51:34 +0000 (-0400) Subject: mount: Fix gcc -fanalyzer warning for parsing androidboot.slot_suffix X-Git-Tag: archive/raspbian/2023.7-3+rpi1~1^2~9^2^2~57^2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=c078e8bea381349dfc2c3a34188603764b0161ff;p=ostree.git mount: Fix gcc -fanalyzer warning for parsing androidboot.slot_suffix If the karg wasn't present, we'd do a NULL deref which is undefined behavior. --- diff --git a/src/switchroot/ostree-mount-util.h b/src/switchroot/ostree-mount-util.h index 7c7c6ce1..180ab2e4 100644 --- a/src/switchroot/ostree-mount-util.h +++ b/src/switchroot/ostree-mount-util.h @@ -137,6 +137,9 @@ static inline char * get_aboot_root_slot (void) { autofree char *slot_suffix = read_proc_cmdline_key ("androidboot.slot_suffix"); + if (!slot_suffix) + errx (EXIT_FAILURE, "Missing androidboot.slot_suffix"); + if (strcmp (slot_suffix, "_a") == 0) return strdup ("/ostree/root.a"); else if (strcmp (slot_suffix, "_b") == 0)