When a status block contains multiple sections, a section without valid FRU fields inherits pointers from the preceding section.
Use empty fru_id and fru_text values whenever the matching VALID bit is not set instead of reusing the value of the previous loop. Signed-off-by: Pierre Gondois <[email protected]> --- drivers/acpi/apei/ghes.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c index 703f3b7f700a6..444d8e82353a7 100644 --- a/drivers/acpi/apei/ghes.c +++ b/drivers/acpi/apei/ghes.c @@ -979,8 +979,8 @@ static void ghes_do_proc(struct ghes *ghes, int sev, sec_sev; struct acpi_hest_generic_data *gdata; guid_t *sec_type; - const guid_t *fru_id = &guid_null; - char *fru_text = ""; + const guid_t *fru_id; + const char *fru_text; bool queued = false; bool sync = is_hest_sync_notify(ghes); @@ -990,9 +990,13 @@ static void ghes_do_proc(struct ghes *ghes, sec_sev = ghes_severity(gdata->error_severity); if (gdata->validation_bits & CPER_SEC_VALID_FRU_ID) fru_id = (guid_t *)gdata->fru_id; + else + fru_id = &guid_null; if (gdata->validation_bits & CPER_SEC_VALID_FRU_TEXT) fru_text = gdata->fru_text; + else + fru_text = ""; ghes_log_hwerr(sev, sec_type); if (guid_equal(sec_type, &CPER_SEC_PLATFORM_MEM)) { -- 2.43.0
