[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20111003163757.GH17108@phenom.oracle.com>
Date: Mon, 3 Oct 2011 12:37:57 -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 9/9] xen/p2m/debugfs: Fix potential pointer
exception.
On Fri, Sep 30, 2011 at 09:18:17AM +0100, Ian Campbell wrote:
> On Thu, 2011-09-29 at 20:52 +0100, Konrad Rzeszutek Wilk wrote:
> > We could be referencing the last + 1 element of level_name[]
> > array which would cause a pointer exception.
>
> If we end up accessing it does that not mean something, i.e. should it
> not be a real string here and not NULL? Otherwise isn't it a bug in the
> lookup code that we end up looking there?
Yup. I altereted it per your recommendation to be "error".
>
> I think this lookup correspond to the initialisation of lvl=4 and
> falling through the subsequent list of checks without matching one. In
> which case I think level_name[4] should be "unknown" or even "error".
Picked "error"
>
> I don't think you can hit type_name[4] in the same way, type and
> prev_type are always one of the TYPE_* defines, which have values 0..3
> inclusive. You could make this more obvious and defend against future
> changes breaking this with:
> ... type_name[] = {
> [TYPE_IDENTITY] = "identity",
> [TYPE_MISSING] = "missing"
> ...
> };
Oooh, pretty. OK, queued another patch with that.
--
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