Fwd: New Defects reported by Coverity Scan for Das U-Boot

Heinrich Schuchardt
2024-01-19T08:47:26Z

________________________________________________________________________________________________________
*** CID 478333: Error handling issues (CHECKED_RETURN)
/lib/efi_loader/efi_firmware.c: 413 in efi_firmware_set_fmp_state_var()
407 /*
408 * GetVariable may fail, EFI_NOT_FOUND is returned if FmpState
409 * variable has not been set yet.
410 * Ignore the error here since the correct FmpState variable
411 * is set later.
412 */
>>> CID 478333: Error handling issues (CHECKED_RETURN)
>>> Calling "efi_get_variable_int" without checking return value (as is done elsewhere 29 out of 33 times).
413 efi_get_variable_int(varname, image_type_id, NULL, &size,
var_state,
414 NULL);
415 416 /*
417 * Only the fw_version is set here.
418 * lowest_supported_version in FmpState variable is ignored since

There are a lot of different return values that may occur when calling
efi_get_variable_int, e.g.

* EFI_BUFFER_TOO_SMALL
* EFI_DEVICE_ERROR

Should we overwrite the variable in these cases with NUL values except
for var_state[update_bank].fw_version?

Best regards

Heinrich