All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Andrey Panin" <pazke@centrinvest.ru>
To: Nathan Fontenot <nfont@austin.ibm.com>
Cc: linuxppc-dev@ozlabs.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 4/5] kernel handling of memory DLPAR
Date: Mon, 14 Sep 2009 10:39:11 +0400	[thread overview]
Message-ID: <20090914063911.GB13139@centrinvest.ru> (raw)
In-Reply-To: <4AAABDBB.7010400@austin.ibm.com>

On 254, 09 11, 2009 at 04:14:35PM -0500, Nathan Fontenot wrote:
> This adds the capability to DLPAR add and remove memory from the kernel.  The
> patch extends the powerpc handling of memory_add_physaddr_to_nid(), which is
> called from the sysfs memory 'probe' file to first ensure that the memory
> has been added to the system.  This is done by creating a platform specific
> callout from the routine.  The pseries implementation of this handles the
> DLPAR work to add the memory to the system and update the device tree.
> 
> The patch also creates a pseries only 'release' sys file,
> /sys/devices/system/memory/release.  This file handles the DLPAR
> release of
> memory back to firmware and updating of the device-tree.
> 
> Signed-off-by: Nathan Fontenot <nfont@austin.ibm.com>

> +static struct property *clone_property(struct property *old_prop)
> +{
> +	struct property *new_prop;
> +
> +	new_prop = kzalloc((sizeof *new_prop), GFP_KERNEL);
> +	if (!new_prop)
> +		return NULL;
> +
> +	new_prop->name = kzalloc(strlen(old_prop->name) + 1, GFP_KERNEL);
> +	new_prop->value = kzalloc(old_prop->length + 1, GFP_KERNEL);

Memory leak here. What if one kzalloc() succeeded and another failed ?

> +	if (!new_prop->name || !new_prop->value) {
> +		free_property(new_prop);
> +		return NULL;
> +	}
> +
> +	strcpy(new_prop->name, old_prop->name);
> +	memcpy(new_prop->value, old_prop->value, old_prop->length);
> +	new_prop->length = old_prop->length;
> +
> +	return new_prop;
> +}

  reply	other threads:[~2009-09-14  6:39 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-11 21:08 [PATCH 0/5] kernel handling of dynamic logical partitioning Nathan Fontenot
2009-09-11 21:10 ` [PATCH 1/5] dynamic logical partitioning infrastructure Nathan Fontenot
2009-09-14 18:30   ` Brian King
2009-09-15 14:15     ` Nathan Fontenot
2009-09-16  1:33   ` Michael Ellerman
2009-09-17 14:45     ` Nathan Fontenot
2009-09-11 21:12 ` [PATCH 2/5] move of_drconf_cell definition to prom.h Nathan Fontenot
2009-09-15 14:38   ` Brian King
2009-09-11 21:13 ` [PATCH 3/5] Export memory_sysdev_class Nathan Fontenot
2009-09-11 21:14 ` [PATCH 4/5] kernel handling of memory DLPAR Nathan Fontenot
2009-09-14  6:39   ` Andrey Panin [this message]
2009-09-14 18:18     ` Nathan Fontenot
2009-09-11 21:15 ` [PATCH 5/5] kernel handling of CPU DLPAR Nathan Fontenot
2009-09-14  6:41   ` Andrey Panin
2009-09-14 18:20     ` Nathan Fontenot
2009-09-15 14:48   ` Brian King
2009-09-11 21:23 ` [PATCH 0/5] kernel handling of dynamic logical partitioning Daniel Walker
2009-09-14 18:22   ` Nathan Fontenot
2009-09-14 18:24     ` Daniel Walker

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=20090914063911.GB13139@centrinvest.ru \
    --to=pazke@centrinvest.ru \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=nfont@austin.ibm.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.