Skip to contentSkip to conversation

efi/libstub: Fixed an issue with screen_info not being initialized

PATCH In review Qiang Ma 2 participants 2 messages Jul 17, 2024 EFI

lore
Share & tools
lore

Qiang Ma

author
#0 lore raw

PATCH 1/1 efi/libstub: Fixed an issue with screen_info not being initialized

After calling uefi interface allocate_pool to apply for memory, we should clear 0 to prevent the possibility of using random values.

---
 drivers/firmware/efi/libstub/screen_info.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/firmware/efi/libstub/screen_info.c +2 -0
index a51ec201ca3c..5d3a1e32d177 100644
@@ -32,6 +32,8 @@ struct screen_info *__alloc_screen_info(void)
 	if (status != EFI_SUCCESS)
 		return NULL;
 
+	memset(si, 0, sizeof(*si));
+
 	status = efi_bs_call(install_configuration_table,
 			     &screen_info_guid, si);
 	if (status == EFI_SUCCESS)
Signature · 1 line
2.20.1
maintainer
#1 lore raw
Quoted 9 lines · Qiang Ma

After calling uefi interface allocate_pool to apply for memory, we should clear 0 to prevent the possibility of using random values.

---
 drivers/firmware/efi/libstub/screen_info.c | 2 ++
 1 file changed, 2 insertions(+)

Thanks. I've queued this as a fix.

Quoted 16 lines
drivers/firmware/efi/libstub/screen_info.c +2 -1
index a51ec201ca3c..5d3a1e32d177 100644
@@ -32,6 +32,8 @@ struct screen_info *__alloc_screen_info(void)
        if (status != EFI_SUCCESS)
                return NULL;
 
+       memset(si, 0, sizeof(*si));
+
        status = efi_bs_call(install_configuration_table,
                             &screen_info_guid, si);
        if (status == EFI_SUCCESS)
--

2.20.1