sd-boot/sd-stub: two log message fixes (#35143)

Fixes: #35033
Fixes: #35100
This commit is contained in:
Yu Watanabe
2024-11-13 10:09:05 +09:00
committed by GitHub
3 changed files with 8 additions and 5 deletions
+1
View File
@@ -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.")
+3 -4
View File
@@ -320,7 +320,7 @@ static void pe_locate_sections(
/* device */ NULL,
&hwids_section);
if (hwids_section.memory_offset != 0) {
if (PE_SECTION_VECTOR_IS_SET(&hwids_section)) {
hwids = (const uint8_t *) SIZE_TO_PTR(validate_base) + hwids_section.memory_offset;
EFI_STATUS err = chid_match(hwids, hwids_section.memory_size, &device);
@@ -328,8 +328,7 @@ static void pe_locate_sections(
log_error_status(err, "HWID matching failed, no DT blob will be selected: %m");
hwids = NULL;
}
} else
log_info("HWIDs section is missing, no DT blob will be selected");
}
}
return pe_locate_sections_internal(
@@ -359,7 +358,7 @@ static uint32_t get_compatibility_entry_address(const DosFileHeader *dos, const
PTR_TO_SIZE(dos),
&vector);
if (vector.memory_size == 0) /* not found */
if (!PE_SECTION_VECTOR_IS_SET(&vector)) /* not found */
return 0;
typedef struct {
+4 -1
View File
@@ -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;
}