Re: [PATCH] x86/efi: initialize status to ensure garbage is not returned on small size

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 20 Jul, at 11:11:06AM, Colin Ian King wrote:
> From: Colin Ian King <colin.king@xxxxxxxxxxxxx>
> 
> 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@xxxxxxxxxxxxx>
> ---
>  arch/x86/boot/compressed/eboot.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/x86/boot/compressed/eboot.c b/arch/x86/boot/compressed/eboot.c
> index ff574da..ec6d2ef 100644
> --- a/arch/x86/boot/compressed/eboot.c
> +++ b/arch/x86/boot/compressed/eboot.c
> @@ -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;

Can this ever happen in practice? This would imply that
locate_protocol() found EFI_UGA_PROTOCOL_GUID but that the size
returned is utterly bogus?

If so, I have no problem applying the patch but want to make sure
we're not tricking ourselves into thinking we're being protected from
something when we're not.
--
To unsubscribe from this list: send the line "unsubscribe linux-efi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux