On Saturday 05 March 2005 17:38, Panagiotis Issaris wrote:

> The EFI driver allocates memory and writes into it without checking the
> success of the allocation:
> 
> 668     efi_char16_t *variable_name = kmalloc(1024, GFP_KERNEL);
> ...
> 696     memset(variable_name, 0, 1024);

> --- linux-2.6.11-orig/drivers/firmware/efivars.c
> +++ linux-2.6.11-pi/drivers/firmware/efivars.c
> @@ -670,6 +670,9 @@ efivars_init(void)

> +     if (!variable_name)
> +             return -ENOMEM;
> +
>       if (!efi_enabled)
>               return -ENODEV; 

I'd better move kmalloc() and checking for success down right before
memset(). Otherwise you leak if efi_enabled == 0.

Oh, and efivars_init() wants to return "error", not unconditionally 0.

        Alexey
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to