efi: don't log if EFI RNG isn't ready
Apparently this happens IRL on some systems, let's handle this gracefully and don't log. Fixes: #35033
This commit is contained in:
@@ -27,6 +27,7 @@ _gnu_printf_(3, 4) EFI_STATUS log_internal(EFI_STATUS status, uint8_t text_color
|
||||
log_internal(status, text_color, "%s:%i@%s: " format, __FILE__, __LINE__, __func__, ##__VA_ARGS__)
|
||||
#define log_debug(...) log_full(EFI_SUCCESS, EFI_LIGHTGRAY, __VA_ARGS__)
|
||||
#define log_info(...) log_full(EFI_SUCCESS, EFI_WHITE, __VA_ARGS__)
|
||||
#define log_warning_status(status, ...) log_full(status, EFI_YELLOW, __VA_ARGS__)
|
||||
#define log_error_status(status, ...) log_full(status, EFI_LIGHTRED, __VA_ARGS__)
|
||||
#define log_error(...) log_full(EFI_INVALID_PARAMETER, EFI_LIGHTRED, __VA_ARGS__)
|
||||
#define log_oom() log_full(EFI_OUT_OF_RESOURCES, EFI_LIGHTRED, "Out of memory.")
|
||||
|
||||
@@ -43,8 +43,11 @@ static EFI_STATUS acquire_rng(void *ret, size_t size) {
|
||||
return EFI_UNSUPPORTED;
|
||||
|
||||
err = rng->GetRNG(rng, NULL, size, ret);
|
||||
/* On some systems the RNG might not be ready during early boot, handle gracefully and don't log. */
|
||||
if (err == EFI_NOT_READY)
|
||||
return err;
|
||||
if (err != EFI_SUCCESS)
|
||||
return log_error_status(err, "Failed to acquire RNG data: %m");
|
||||
return log_warning_status(err, "Failed to acquire RNG data, proceeding without: %m");
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user