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>
/* 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;
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)) {