All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dario Faggioli <dario.faggioli@citrix.com>
To: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: George Dunlap <george.dunlap@eu.citrix.com>,
	Keir Fraser <keir@xen.org>, Meng Xu <mengxu@cis.upenn.edu>,
	Jan Beulich <JBeulich@suse.com>,
	Xen-devel <xen-devel@lists.xen.org>
Subject: Re: [PATCH] xen/sched_rc: Fix memory leak in rt_init()
Date: Fri, 5 Jun 2015 12:07:39 +0200	[thread overview]
Message-ID: <1433498859.21654.9.camel@citrix.com> (raw)
In-Reply-To: <1433497776-8385-1-git-send-email-andrew.cooper3@citrix.com>


[-- Attachment #1.1: Type: text/plain, Size: 1587 bytes --]

On Fri, 2015-06-05 at 10:49 +0100, Andrew Cooper wrote:
> Introduced by c/s 376bbba "sched_rt: print useful affinity info when dumping".
> If the allocation of cpumask failed, prv was leaked.
> 
Wow... I really did a _great_ job with that patch, didn't I? :-//

> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
> Coverity-ID: 1304398
> CC: Keir Fraser <keir@xen.org>
> CC: Jan Beulich <JBeulich@suse.com>
> CC: Dario Faggioli <dario.faggioli@citrix.com>
> CC: George Dunlap <george.dunlap@eu.citrix.com>
> CC: Meng Xu <mengxu@cis.upenn.edu>
>
Reviewed-by: Dario Faggioli <dario.faggioli@citrix.com>

Although, I'd rather...

> diff --git a/xen/common/sched_rt.c b/xen/common/sched_rt.c
> index 5836d27..4372486 100644
> --- a/xen/common/sched_rt.c
> +++ b/xen/common/sched_rt.c
> @@ -441,7 +441,7 @@ static inline struct list_head *rt_depletedq(const struct scheduler *ops)
>      {
>          _cpumask_scratch = xmalloc_array(cpumask_var_t, nr_cpu_ids);
>          if ( !_cpumask_scratch )
> -            return -ENOMEM;
> +            goto no_mem;
>
free it right away here (just one added line), instead of "clobbering"
the tail of the function, since it's just this.

But, really, I'm ok with the fix as is. Thanks for taking the time of
sending the patch! :-)

Regards, Dario
-- 
<<This happens because I choose it to happen!>> (Raistlin Majere)
-----------------------------------------------------------------
Dario Faggioli, Ph.D, http://about.me/dario.faggioli
Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK)

[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

[-- Attachment #2: Type: text/plain, Size: 126 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

  reply	other threads:[~2015-06-05 10:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-05  9:49 [PATCH] xen/sched_rc: Fix memory leak in rt_init() Andrew Cooper
2015-06-05 10:07 ` Dario Faggioli [this message]
2015-06-08 12:19 ` Jan Beulich

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=1433498859.21654.9.camel@citrix.com \
    --to=dario.faggioli@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=george.dunlap@eu.citrix.com \
    --cc=keir@xen.org \
    --cc=mengxu@cis.upenn.edu \
    --cc=xen-devel@lists.xen.org \
    /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.