diff options
author | Samuel Mendoza-Jonas <sam@mendozajonas.com> | 2016-06-01 16:39:18 +1000 |
---|---|---|
committer | Samuel Mendoza-Jonas <sam@mendozajonas.com> | 2016-06-16 10:56:08 +1000 |
commit | b2c6831dbf569b90c8873392834cdf697555beae (patch) | |
tree | c0fc222906ca61f15bc91d99233895367be2fdf5 | |
parent | 80343e07470e28e30efa36c3a7fdb7b129117b34 (diff) | |
download | petitboot-b2c6831dbf569b90c8873392834cdf697555beae.zip petitboot-b2c6831dbf569b90c8873392834cdf697555beae.tar.gz |
discover/platform-powerpc: Return bootdev error correctlyv1.1.1
In one case get_ipmi_bootdev_ipmi() can return 0 on an error, which
leads to bootdev being treated as a valid bootdev despite being
uninitialised. If the planets line up correctly and bootdev is less than
or equal to IPMI_BOOTDEV_SETUP, Petitboot will incorrectly apply an IPMI
override.
Update the error return value in get_ipmi_bootdev_ipmi(), and properly
initialise bootdev.
Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
-rw-r--r-- | discover/platform-powerpc.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/discover/platform-powerpc.c b/discover/platform-powerpc.c index 1961304..1f8d27d 100644 --- a/discover/platform-powerpc.c +++ b/discover/platform-powerpc.c @@ -956,7 +956,7 @@ static int get_ipmi_bootdev_ipmi(struct platform_powerpc *platform, /* check for valid flags */ if (!(resp[3] & 0x80)) { pb_debug("platform: boot flags are invalid, ignoring\n"); - return 0; + return -1; } *persistent = resp[3] & 0x40; @@ -1230,7 +1230,7 @@ static int load_config(struct platform *p, struct config *config) if (platform->get_ipmi_bootdev) { bool bootdev_persistent; - uint8_t bootdev; + uint8_t bootdev = IPMI_BOOTDEV_INVALID; rc = platform->get_ipmi_bootdev(platform, &bootdev, &bootdev_persistent); if (!rc && ipmi_bootdev_is_valid(bootdev)) { |