]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
efi/libstub: Zero initialize heap allocated struct screen_info
authorQiang Ma <maqianga@uniontech.com>
Wed, 17 Jul 2024 07:00:43 +0000 (15:00 +0800)
committerArd Biesheuvel <ardb@kernel.org>
Wed, 17 Jul 2024 20:51:20 +0000 (22:51 +0200)
After calling uefi interface allocate_pool to apply for memory, we
should clear 0 to prevent the possibility of using random values.

Signed-off-by: Qiang Ma <maqianga@uniontech.com>
Cc: <stable@vger.kernel.org> # v6.6+
Fixes: 732ea9db9d8a ("efi: libstub: Move screen_info handling to common code")
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
drivers/firmware/efi/libstub/screen_info.c

index a51ec201ca3cbef97c1ef911102b179b9b0efb0f..5d3a1e32d1776b9c70280e05d7b640f4b91e5767 100644 (file)
@@ -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)