From 56350400918c6979c60d46b7825e9671ee31f09c Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 11 Feb 2022 22:19:35 +0100 Subject: [PATCH] bootspec: make sure all return values are initialized on return of find_esp_and_warn() THis makes sure that find_esp_and_warn() + find_xbootldr_and_warn() follow our usual coding style that on success all return values are initialized. We got that right in most successful codepaths out of these functions, but missed the one where the paths are manually overwritten via env vars. --- src/shared/bootspec.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/shared/bootspec.c b/src/shared/bootspec.c index 15b77f01b21..7c74cf6f182 100644 --- a/src/shared/bootspec.c +++ b/src/shared/bootspec.c @@ -1263,6 +1263,16 @@ int find_esp_and_warn( /* Note: when the user explicitly configured things with an env var we won't validate the mount * point. After all we want this to be useful for testing. */ + + if (ret_part) + *ret_part = 0; + if (ret_pstart) + *ret_pstart = 0; + if (ret_psize) + *ret_psize = 0; + if (ret_uuid) + *ret_uuid = SD_ID128_NULL; + goto found; } @@ -1489,6 +1499,9 @@ int find_xbootldr_and_warn( "$SYSTEMD_XBOOTLDR_PATH does not refer to absolute path, refusing to use it: %s", path); + if (ret_uuid) + *ret_uuid = SD_ID128_NULL; + goto found; } -- 2.47.3