[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH] xen/sched_rc: Fix memory leak in rt_init()



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@xxxxxxxxxx>
> Coverity-ID: 1304398
> CC: Keir Fraser <keir@xxxxxxx>
> CC: Jan Beulich <JBeulich@xxxxxxxx>
> CC: Dario Faggioli <dario.faggioli@xxxxxxxxxx>
> CC: George Dunlap <george.dunlap@xxxxxxxxxxxxx>
> CC: Meng Xu <mengxu@xxxxxxxxxxxxx>
>
Reviewed-by: Dario Faggioli <dario.faggioli@xxxxxxxxxx>

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: signature.asc
Description: This is a digitally signed message part

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

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.