The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Len Brown <len.brown@intel.com>
To: "Om Narasimhan" <om.turyx@gmail.com>
Cc: linux-kernel@vger.kernel.org, kernel-janitors@lists.osdl.org
Subject: Re: memory leak fix in acpi_memhotplug.c, kmalloc to kzalloc conversion.
Date: Sat, 26 Aug 2006 21:43:36 -0400	[thread overview]
Message-ID: <200608262143.37390.len.brown@intel.com> (raw)
In-Reply-To: <6b4e42d10608261721h7807e45h6f20a2327f368719@mail.gmail.com>

On Saturday 26 August 2006 20:21, Om Narasimhan wrote:
> Hi,
> This patch fixes one memory leak in drivers/acpi/acpi_memhotplug.c
> Replaces all kmalloc() calls succeeded by memset() to kzalloc() calls.
> Applies cleanly to 2.6.18-rc4. Compile tested.

Compile testing is more effective is you use a .config that
builds each of the source files changed.

> Patch starts here.
> 
> 
>  drivers/acpi/ac.c              |    4 +---
>  drivers/acpi/acpi_memhotplug.c |   14 +++++---------
>  drivers/acpi/asus_acpi.c       |    3 +--
>  drivers/acpi/battery.c         |   13 +++----------
>  drivers/acpi/bus.c             |    3 +--
>  drivers/acpi/button.c          |    4 +---
>  drivers/acpi/container.c       |    4 +---
>  drivers/acpi/ec.c              |   20 +++++---------------
>  drivers/acpi/fan.c             |    3 +--
>  drivers/acpi/i2c_ec.c          |    8 ++------
>  drivers/acpi/osl.c             |    2 +-
>  drivers/acpi/pci_bind.c        |   21 +++++----------------
>  drivers/acpi/pci_irq.c         |   16 +++-------------
>  drivers/acpi/pci_link.c        |    6 ++----
>  drivers/acpi/pci_root.c        |    3 +--
>  drivers/acpi/power.c           |    4 +---
>  drivers/acpi/processor_core.c  |    4 +---
>  drivers/acpi/sbs.c             |    4 +---
>  drivers/acpi/thermal.c         |   13 +++----------
>  drivers/acpi/utils.c           |    4 +---
>  20 files changed, 40 insertions(+), 113 deletions(-)

Please direct patches touching drivers/acpi to me, cc linux-acpi@vger.kernel.org

> diff --git a/drivers/acpi/ac.c b/drivers/acpi/ac.c
> index 96309b9..72738a5 100644
> --- a/drivers/acpi/ac.c
> +++ b/drivers/acpi/ac.c
> @@ -221,11 +221,9 @@ static int acpi_ac_add(struct acpi_devic
>  	if (!device)
>  		return -EINVAL;
> 
> -	ac = kmalloc(sizeof(struct acpi_ac), GFP_KERNEL);
> +	ac = kzalloc(sizeof(struct acpi_ac), GFP_KERNEL);
>  	if (!ac)
>  		return -ENOMEM;
> -	memset(ac, 0, sizeof(struct acpi_ac));
> -
>  	ac->device = device;
>  	strcpy(acpi_device_name(device), ACPI_AC_DEVICE_NAME);
>  	strcpy(acpi_device_class(device), ACPI_AC_CLASS);
> diff --git a/drivers/acpi/acpi_memhotplug.c b/drivers/acpi/acpi_memhotplug.c
> index b0d4b14..eb8a5da 100644
> --- a/drivers/acpi/acpi_memhotplug.c
> +++ b/drivers/acpi/acpi_memhotplug.c
> @@ -297,6 +297,7 @@ static int acpi_memory_disable_device(st
>  	 * Ask the VM to offline this memory range.
>  	 * Note: Assume that this function returns zero on success
>  	 */
> +	struct acpi_memory_info *info, *n;

What tree is this patch against?
This line is already present (above the comment) in 2.6.18-rc4.

thanks,
-Len


  reply	other threads:[~2006-08-27  1:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-27  0:21 memory leak fix in acpi_memhotplug.c, kmalloc to kzalloc conversion Om Narasimhan
2006-08-27  1:43 ` Len Brown [this message]
2006-08-27  4:06   ` Om Narasimhan
2006-08-27  4:30     ` Om Narasimhan

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=200608262143.37390.len.brown@intel.com \
    --to=len.brown@intel.com \
    --cc=kernel-janitors@lists.osdl.org \
    --cc=lenb@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=om.turyx@gmail.com \
    /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