public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Alexey Dobriyan <adobriyan@mail.ru>
To: "Panagiotis Issaris" <panagiotis.issaris@mech.kuleuven.ac.be>
Cc: Matt_Domsch@dell.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] EFI missing failure handling
Date: Sat, 5 Mar 2005 19:06:29 +0200	[thread overview]
Message-ID: <200503051906.31518.adobriyan@mail.ru> (raw)
In-Reply-To: <20050305153841.GA7808@mech.kuleuven.ac.be>

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

  reply	other threads:[~2005-03-05 16:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-05 15:38 [PATCH] EFI missing failure handling Panagiotis Issaris
2005-03-05 17:06 ` Alexey Dobriyan [this message]
2005-03-05 20:17   ` Panagiotis Issaris
2005-03-05 21:18     ` Matt Domsch

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200503051906.31518.adobriyan@mail.ru \
    --to=adobriyan@mail.ru \
    --cc=Matt_Domsch@dell.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=panagiotis.issaris@mech.kuleuven.ac.be \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox