public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: Len Brown <lenb@kernel.org>
To: Thomas Renninger <trenn@suse.de>
Cc: Carlos Corbacho <carlos@strangeworlds.co.uk>,
	Matthew Garrett <mjg59@srcf.ucam.org>,
	linux-acpi@vger.kernel.org
Subject: Re: [PATCH 2/2] x86 platform drivers, hp-wmi: Fix two memleaks
Date: Thu, 24 Dec 2009 00:56:53 -0500 (EST)	[thread overview]
Message-ID: <alpine.LFD.2.00.0912240054570.6541@localhost.localdomain> (raw)
In-Reply-To: <1261146563-2228-2-git-send-email-trenn@suse.de>



thanks,
Len Brown, Intel Open Source Technology Center

On Fri, 18 Dec 2009, Thomas Renninger wrote:

> CC: Carlos Corbacho <carlos@strangeworlds.co.uk>
> CC: Matthew Garrett <mjg59@srcf.ucam.org>
> CC: linux-acpi@vger.kernel.org
> CC: Len Brown <lenb@kernel.org>
> 
> Signed-off-by: Thomas Renninger <trenn@suse.de>
> ---
>  drivers/platform/x86/hp-wmi.c |   10 +++++++++-
>  1 files changed, 9 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/platform/x86/hp-wmi.c b/drivers/platform/x86/hp-wmi.c
> index 63c3e65..01a0913 100644
> --- a/drivers/platform/x86/hp-wmi.c
> +++ b/drivers/platform/x86/hp-wmi.c
> @@ -134,10 +134,15 @@ static int hp_wmi_perform_query(int query, int write, int value)
>  
>  	obj = output.pointer;
>  
> -	if (!obj || obj->type != ACPI_TYPE_BUFFER)
> +	if (!obj)
>  		return -EINVAL;
> +	else if (obj->type != ACPI_TYPE_BUFFER) {
> +		kfree(obj);
> +		return -EINVAL;
> +	}
>  
>  	bios_return = *((struct bios_return *)obj->buffer.pointer);
> +	kfree(obj);
>  	if (bios_return.return_code > 0)
>  		return bios_return.return_code * -1;
>  	else
> @@ -340,10 +345,13 @@ static void hp_wmi_notify(u32 value, void *context)
>  
>  	if (!obj || obj->type != ACPI_TYPE_BUFFER || obj->buffer.length != 8) {
>  		printk(KERN_INFO "HP WMI: Unknown response received\n");
> +		if (obj)
> +			kfree(obj);

WARNING: kfree(NULL) is safe this check is probably not required
#44: FILE: drivers/platform/x86/hp-wmi.c:349:
+		if (obj)
+			kfree(obj);

so I deleted "if(obj)" above and applied the patch.

thanks,
Len Brown, Intel Open Source Technology Center

>  		return;
>  	}
>  
>  	eventcode = *((u8 *) obj->buffer.pointer);
> +	kfree(obj);
>  	if (eventcode == 0x4)
>  		eventcode = hp_wmi_perform_query(HPWMI_HOTKEY_QUERY, 0,
>  						0);
> -- 


  reply	other threads:[~2009-12-24  5:57 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-18 14:29 [PATCH 1/2] x86 platform drivers, wmi: Remove needless dmi MODULE_ALIAS Thomas Renninger
2009-12-18 14:29 ` [PATCH 2/2] x86 platform drivers, hp-wmi: Fix two memleaks Thomas Renninger
2009-12-24  5:56   ` Len Brown [this message]
2009-12-18 16:43 ` [PATCH 1/2] x86 platform drivers, wmi: Remove needless dmi MODULE_ALIAS Carlos Corbacho
2009-12-18 17:44 ` Anisse Astier
2009-12-18 17:54   ` Matthew Garrett
2009-12-20 20:15     ` Anisse Astier
2009-12-24  5:50 ` Len Brown

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=alpine.LFD.2.00.0912240054570.6541@localhost.localdomain \
    --to=lenb@kernel.org \
    --cc=carlos@strangeworlds.co.uk \
    --cc=linux-acpi@vger.kernel.org \
    --cc=mjg59@srcf.ucam.org \
    --cc=trenn@suse.de \
    /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