On Mon, Jun 03, 2013 at 04:59:31AM -0700, Joe Perches wrote:
> On Mon, 2013-06-03 at 12:57 +0300, Dan Carpenter wrote:
> > On Fri, May 31, 2013 at 09:11:23PM -0700, Joe Perches wrote:
> > > +static const char *sense_key_string(__u8 index)
> > > +{
> > > + static const char *info[9] = {
> > > +         "No sense", "Recovered error", "Not ready",
> > > +         "Medium error", "Hardware error", "Illegal request",
> > > +         "Unit attention", "Data protect", "Blank check"
> > > + };
> > > + if (index < 8)
> > 
> > Off by one:
> > 
> >     if (index < 9)
> 
> Kinda, but that's the original code.
> 
> It should be ARRAY_SIZE and I think it should be
> done in a separate patch.
> 
> Someone should say if "Blank check" is really one
> of the sense key values possible or if it should
> just be deleted.

Read it again.  ;)  In the original code, 8 was valid.

Andy is right though that it should be ARRAY_SIZE().

regards,
dan carpenter

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to