Re: [libvirt] [PATCH] remote_internal.c: don't dereference a NULL conn

2009-09-03 Thread Jim Meyering
Jim Paris wrote: Daniel P. Berrange wrote: On Wed, Sep 02, 2009 at 12:26:43PM +0200, Jim Meyering wrote: Daniel Veillard wrote: On Wed, Sep 02, 2009 at 11:58:07AM +0200, Jim Meyering wrote: Here's the test just before the else-if in the patch below: if (conn

Re: [libvirt] [PATCH] remote_internal.c: don't dereference a NULL conn

2009-09-03 Thread Daniel P. Berrange
On Wed, Sep 02, 2009 at 11:48:21AM -0400, Jim Paris wrote: Yeah, for functions where it is expected that the passed in param be non-NULL, then annotations are definitely the way togo. This lets the compiler/checkers validate the callers instead, avoiding the need to clutter the methods

[libvirt] [PATCH] remote_internal.c: don't dereference a NULL conn

2009-09-02 Thread Jim Meyering
Here's the test just before the else-if in the patch below: if (conn conn-driver STREQ (conn-driver-name, remote)) { So, in the else-branch, conn is guaranteed to be NULL. And dereferenced. This may be only a theoretical risk, but if so, the test of conn above should be

Re: [libvirt] [PATCH] remote_internal.c: don't dereference a NULL conn

2009-09-02 Thread Daniel Veillard
On Wed, Sep 02, 2009 at 11:58:07AM +0200, Jim Meyering wrote: Here's the test just before the else-if in the patch below: if (conn conn-driver STREQ (conn-driver-name, remote)) { So, in the else-branch, conn is guaranteed to be NULL. And dereferenced. This may be

Re: [libvirt] [PATCH] remote_internal.c: don't dereference a NULL conn

2009-09-02 Thread Jim Meyering
Daniel Veillard wrote: On Wed, Sep 02, 2009 at 11:58:07AM +0200, Jim Meyering wrote: Here's the test just before the else-if in the patch below: if (conn conn-driver STREQ (conn-driver-name, remote)) { So, in the else-branch, conn is guaranteed to be NULL. And

Re: [libvirt] [PATCH] remote_internal.c: don't dereference a NULL conn

2009-09-02 Thread Jim Meyering
Jim Meyering wrote: Daniel Veillard wrote: On Wed, Sep 02, 2009 at 11:58:07AM +0200, Jim Meyering wrote: Here's the test just before the else-if in the patch below: if (conn conn-driver STREQ (conn-driver-name, remote)) { So, in the else-branch, conn is guaranteed to

Re: [libvirt] [PATCH] remote_internal.c: don't dereference a NULL conn

2009-09-02 Thread Daniel P. Berrange
On Wed, Sep 02, 2009 at 12:26:43PM +0200, Jim Meyering wrote: Daniel Veillard wrote: On Wed, Sep 02, 2009 at 11:58:07AM +0200, Jim Meyering wrote: Here's the test just before the else-if in the patch below: if (conn conn-driver STREQ (conn-driver-name, remote)) {

Re: [libvirt] [PATCH] remote_internal.c: don't dereference a NULL conn

2009-09-02 Thread Paolo Bonzini
Does __attribute__((__nonnull__())) really cover the case we're concerned about here? No, not at all. Good catch. Paolo -- Libvir-list mailing list Libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list