[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <alpine.LNX.2.00.1107021956290.16316@swampdragon.chaosbits.net>
Date: Sat, 2 Jul 2011 19:57:10 +0200 (CEST)
From: Jesper Juhl <jj@...osbits.net>
To: David Teigland <teigland@...hat.com>
cc: linux-kernel@...r.kernel.org, cluster-devel@...hat.com,
Christine Caulfield <ccaulfie@...hat.com>
Subject: Re: [PATCH] fs, dlm: Don't leak, don't do pointless NULL checks and
use kzalloc
On Wed, 29 Jun 2011, David Teigland wrote:
> On Wed, Jun 29, 2011 at 11:51:00PM +0200, Jesper Juhl wrote:
> > > I don't think so; num_nodes won't be set to zero.
> >
> > Hmm. How so? Maybe I'm missing something obvious, but;
> > num_nodes is initialized to zero at the beginning of the function, which
> > means that we'll definately do the first allocation in the loop.
>
> Zero is meant to mean "first time through the loop".
>
> > We then set num_nodes equal to ls->ls_num_nodes - what guarantees that
> > this will not be zero so we won't do a second allocation (and leak) the
> > second time through the loop?
>
> That's just the nature of a lockspace, I guess -- it doesn't make sense or
> exist without nodes in it. I doubt any of the dlm code would work if that
> weren't true.
>
Thank you for the explanation.
I've prepared a new patch with just the changes you ack'ed. I'll send it
in a minute.
--
Jesper Juhl <jj@...osbits.net> http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists