qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 2/2] qemu queue: fix uninitialized removals


From: Peter Maydell
Subject: Re: [Qemu-devel] [PATCH 2/2] qemu queue: fix uninitialized removals
Date: Thu, 18 Oct 2012 14:48:22 +0100

On 14 October 2012 14:08, Tim Hardeck <address@hidden> wrote:
> When calling QTAILQ_REMOVE or QLIST_REMOVE on an unitialized list
> QEMU segfaults.
>
> Check for this case specifically on item removal.

Incidentally, this commit message is inaccurate -- you can't
call the _REMOVE macros on a list (uninitialised or otherwise)
because they take the list item, not the list itself. The
case you are trying to guard against here is attempting to
remove an item which never got inserted into the list in
the first place.

However this check doesn't catch all cases, because (a)
there's no guarantee that the list element pointers get
initialised to NULL and (b) removing an item from the
list doesn't clear the pointers either, so this check
still wouldn't catch "removed the item twice". Better
just to accept that the semantics are "you can only use
the _REMOVE macro on items that are actually in the list",
I think.

-- PMM



reply via email to

[Prev in Thread] Current Thread [Next in Thread]