[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20111003162644.GF17108@phenom.oracle.com>
Date: Mon, 3 Oct 2011 12:26:44 -0400
From: Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>
To: Ian Campbell <Ian.Campbell@...rix.com>
Cc: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"xen-devel@...ts.xensource.com" <xen-devel@...ts.xensource.com>,
Dan Carpenter <error27@...il.com>
Subject: Re: [Xen-devel] [PATCH 7/9] xen/xenbus: Check before dereferencing
it.
On Fri, Sep 30, 2011 at 09:01:21AM +0100, Ian Campbell wrote:
> On Thu, 2011-09-29 at 20:52 +0100, Konrad Rzeszutek Wilk wrote:
> > . we do the check whether 'xdev' is NULL - but after we have
> > dereferenced it.
> >
> > Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>
> > ---
> > drivers/xen/xenbus/xenbus_probe_backend.c | 3 ++-
> > 1 files changed, 2 insertions(+), 1 deletions(-)
> >
> > diff --git a/drivers/xen/xenbus/xenbus_probe_backend.c b/drivers/xen/xenbus/xenbus_probe_backend.c
> > index 60adf91..331589a 100644
> > --- a/drivers/xen/xenbus/xenbus_probe_backend.c
> > +++ b/drivers/xen/xenbus/xenbus_probe_backend.c
> > @@ -103,10 +103,11 @@ static int xenbus_uevent_backend(struct device *dev,
> > return -ENODEV;
> >
> > xdev = to_xenbus_device(dev);
>
> to_xenbus_device is just container_of. The only way it would return NULL
> is if dev == offsetof(struct xenbus_device, dev), which isn't terribly
> likely. A more likely error would be dev == NULL and we just checked
> above.
>
> > - bus = container_of(xdev->dev.bus, struct xen_bus_type, bus);
> > if (xdev == NULL)
> > return -ENODEV;
Hm, in which case this 'xdev == NULL' is pointless. Will remove it.
--
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