From: Lennart Poettering Date: Fri, 11 Feb 2022 21:19:35 +0000 (+0100) Subject: bootspec: make sure all return values are initialized on return of find_esp_and_warn() X-Git-Tag: v251-rc1~293^2~2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=56350400918c6979c60d46b7825e9671ee31f09c;p=thirdparty%2Fsystemd.git 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. --- 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; }