From: David Rientjes <rientjes@google.com>
To: Miao Xie <miaox@cn.fujitsu.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Paul Menage <menage@google.com>,
Linux-Kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH -mmotm 2/2] cpuset: alloc nodemask_t at heap not stack - fix
Date: Fri, 12 Mar 2010 01:45:38 -0800 (PST) [thread overview]
Message-ID: <alpine.DEB.2.00.1003120145210.22682@chino.kir.corp.google.com> (raw)
In-Reply-To: <4B99E634.2070608@cn.fujitsu.com>
On Fri, 12 Mar 2010, Miao Xie wrote:
> fix memory leak
>
> Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
> ---
> Against the following patch in mmotm-2010-03-11-13-13:
> cpuset-alloc-nodemask_t-at-heap-not-stack.patch
> ---
> kernel/cpuset.c | 10 +++++++---
> 1 files changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/kernel/cpuset.c b/kernel/cpuset.c
> index f36e577..8e27d00 100644
> --- a/kernel/cpuset.c
> +++ b/kernel/cpuset.c
> @@ -1401,7 +1401,7 @@ static void cpuset_attach(struct cgroup_subsys *ss, struct cgroup *cont,
> NODEMASK_ALLOC(nodemask_t, to, GFP_KERNEL);
>
> if (from == NULL || to == NULL)
> - return;
> + goto alloc_fail;
>
> if (cs == &top_cpuset) {
> cpumask_copy(cpus_attach, cpu_possible_mask);
> @@ -1432,8 +1432,12 @@ static void cpuset_attach(struct cgroup_subsys *ss, struct cgroup *cont,
> mmput(mm);
> }
>
> - NODEMASK_FREE(from);
> - NODEMASK_FREE(to);
> +alloc_fail:
> + if (from)
> + NODEMASK_FREE(from);
> +
> + if (to)
> + NODEMASK_FREE(to);
kfree() can take NULL pointers.
prev parent reply other threads:[~2010-03-12 9:45 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-12 6:59 Miao Xie
2010-03-12 9:45 ` David Rientjes [this message]
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.DEB.2.00.1003120145210.22682@chino.kir.corp.google.com \
--to=rientjes@google.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=menage@google.com \
--cc=miaox@cn.fujitsu.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
all inboxes | Powered by JetHome®