x86/efi: Initialize status to ensure garbage is not returned on small size
authorColin Ian King <colin.king@canonical.com>
Wed, 20 Jul 2016 10:11:06 +0000 (11:11 +0100)
committerMatt Fleming <matt@codeblueprint.co.uk>
Fri, 9 Sep 2016 15:08:44 +0000 (16:08 +0100)
Although very unlikey, if size is too small or zero, then we end up with
status not being set and returning garbage. Instead, initializing status to
EFI_INVALID_PARAMETER to indicate that size is invalid in the calls to
setup_uga32 and setup_uga64.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Matt Fleming <matt@codeblueprint.co.uk>
arch/x86/boot/compressed/eboot.c

index ff574dad95ccaf2739d0edfe85c94acea1e15134..ec6d2ef12baff28b7247d88b896aca3758f4b8e9 100644 (file)
@@ -578,7 +578,7 @@ setup_uga32(void **uga_handle, unsigned long size, u32 *width, u32 *height)
        efi_guid_t uga_proto = EFI_UGA_PROTOCOL_GUID;
        unsigned long nr_ugas;
        u32 *handles = (u32 *)uga_handle;;
-       efi_status_t status;
+       efi_status_t status = EFI_INVALID_PARAMETER;
        int i;
 
        first_uga = NULL;
@@ -623,7 +623,7 @@ setup_uga64(void **uga_handle, unsigned long size, u32 *width, u32 *height)
        efi_guid_t uga_proto = EFI_UGA_PROTOCOL_GUID;
        unsigned long nr_ugas;
        u64 *handles = (u64 *)uga_handle;;
-       efi_status_t status;
+       efi_status_t status = EFI_INVALID_PARAMETER;
        int i;
 
        first_uga = NULL;