All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tiddyup tools/xenstore/talloc.c
@ 2005-08-11 21:15 Jerone Young
  2005-08-11 21:58 ` Keir Fraser
  0 siblings, 1 reply; 4+ messages in thread
From: Jerone Young @ 2005-08-11 21:15 UTC (permalink / raw)
  To: xen-devel

Add check so that p is not operated on if context is not also null.

Signed-off-by: Jerone Young <jyoung5@us.ibm.com>

--- tools/xenstore/talloc.c.old 2005-08-11 11:48:59.000000000 -0500
+++ tools/xenstore/talloc.c     2005-08-11 12:30:14.000000000 -0500
@@ -292,7 +292,7 @@ static int talloc_unreference(const void

        for (h=tc->refs;h;h=h->next) {
                struct talloc_chunk *p = talloc_parent_chunk(h);
-               if ((p==NULL && context==NULL) || p+1 == context) break;
+               if (p==NULL || context==NULL || p+1 == context) break;
        }
        if (h == NULL) {
                return -1;


-- 
Jerone Young
IBM Linux Technology Center
jyoung5@us.ibm.com
512-838-1157 (T/L: 678-1157)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] tiddyup tools/xenstore/talloc.c
  2005-08-11 21:15 [PATCH] tiddyup tools/xenstore/talloc.c Jerone Young
@ 2005-08-11 21:58 ` Keir Fraser
  2005-08-11 22:05   ` Jerone Young
  2005-08-12  3:32   ` Rusty Russell
  0 siblings, 2 replies; 4+ messages in thread
From: Keir Fraser @ 2005-08-11 21:58 UTC (permalink / raw)
  To: Jerone Young; +Cc: xen-devel


On 11 Aug 2005, at 22:15, Jerone Young wrote:

> Add check so that p is not operated on if context is not also null.
>
> Signed-off-by: Jerone Young <jyoung5@us.ibm.com>

No idea on this one. I think that case is probably impossible so the 
test could just be simplified, but probably only tridge knows for sure. 
:-)

I think xenstore can probably be weaned off talloc at some point.

  -- Keir

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] tiddyup tools/xenstore/talloc.c
  2005-08-11 21:58 ` Keir Fraser
@ 2005-08-11 22:05   ` Jerone Young
  2005-08-12  3:32   ` Rusty Russell
  1 sibling, 0 replies; 4+ messages in thread
From: Jerone Young @ 2005-08-11 22:05 UTC (permalink / raw)
  To: Keir Fraser; +Cc: xen-devel

On Thu, 2005-08-11 at 22:58 +0100, Keir Fraser wrote:
> On 11 Aug 2005, at 22:15, Jerone Young wrote:
> 
> > Add check so that p is not operated on if context is not also null.
> >
> > Signed-off-by: Jerone Young <jyoung5@us.ibm.com>
> 
> No idea on this one. I think that case is probably impossible so the 
> test could just be simplified, but probably only tridge knows for sure. 
> :-)

I agree..the case is very very very not likely but I figured I would
submit the patch anyway so our tree was nice and safe ;-)

> 
> I think xenstore can probably be weaned off talloc at some point.
> 
>   -- Keir
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xensource.com
> http://lists.xensource.com/xen-devel
> 
-- 
Jerone Young
IBM Linux Technology Center
jyoung5@us.ibm.com
512-838-1157 (T/L: 678-1157)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] tiddyup tools/xenstore/talloc.c
  2005-08-11 21:58 ` Keir Fraser
  2005-08-11 22:05   ` Jerone Young
@ 2005-08-12  3:32   ` Rusty Russell
  1 sibling, 0 replies; 4+ messages in thread
From: Rusty Russell @ 2005-08-12  3:32 UTC (permalink / raw)
  To: Keir Fraser; +Cc: Jerone Young, xen-devel

On Thu, 2005-08-11 at 22:58 +0100, Keir Fraser wrote:
> On 11 Aug 2005, at 22:15, Jerone Young wrote:
> 
> > Add check so that p is not operated on if context is not also null.
> >
> > Signed-off-by: Jerone Young <jyoung5@us.ibm.com>
> 
> No idea on this one. I think that case is probably impossible so the 
> test could just be simplified, but probably only tridge knows for sure. 
> :-)

Actually the code is fine: it looks for a reference to the given parent
context.  p + 1 cannot be NULL, since either p is NULL, or (p + 1) has
at some stage been returned by _talloc(), which cannot return NULL.

> I think xenstore can probably be weaned off talloc at some point.

Heh, good luck with that!  Removing the destructors and replacing them
with explicit calls would not be too complicated, as the structures are
all fairly simple, but you'll be chasing down memory leaks for a long
time through all the failure paths.

You will have lots and lots of fun handling out-of-memory conditions,
which we do at the moment although, regrettably, not everywhere: if
destroy_path() fails we abort the daemon 8(.

Actually, the OOM code is ugly and I'd love to get rid of it, but I know
people like these kind of checks, even if they're never 100%.

Rusty.
-- 
A bad analogy is like a leaky screwdriver -- Richard Braakman

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-08-12  3:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-08-11 21:15 [PATCH] tiddyup tools/xenstore/talloc.c Jerone Young
2005-08-11 21:58 ` Keir Fraser
2005-08-11 22:05   ` Jerone Young
2005-08-12  3:32   ` Rusty Russell

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.