Skip to content

Commit

Permalink
mount: Fix gcc -fanalyzer warning for parsing androidboot.slot_suffix
Browse files Browse the repository at this point in the history
If the karg wasn't present, we'd do a NULL deref which is undefined
behavior.
  • Loading branch information
cgwalters committed Jul 14, 2023
1 parent c4f1d18 commit c078e8b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/switchroot/ostree-mount-util.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit c078e8b

Please sign in to comment.