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 th

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 (

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

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

2009-09-02 Thread Jim Paris
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 && > > >> co

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

2009-09-02 Thread Jim Meyering
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 && >> >> conn->d

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->

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 el

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 guarantee

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 dereferenc

[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