RE: [PATCH] libnvdimm/namespace: Fix a signedness bug in __holder_class_store()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> 
> On Wed, 2019-09-25 at 14:00 +0300, Dan Carpenter wrote:
> > The "ndns->claim_class" variable is an enum but in this case GCC will
> > treat it as an unsigned int so the error handling is never triggered.
> >
> > Fixes: 14e494542636 ("libnvdimm, btt: BTT updates for UEFI 2.7
> > format")
> > Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
> > ---
> >  drivers/nvdimm/namespace_devs.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/nvdimm/namespace_devs.c
> > b/drivers/nvdimm/namespace_devs.c index cca0a3ba1d2c..669985527716
> > 100644
> > --- a/drivers/nvdimm/namespace_devs.c
> > +++ b/drivers/nvdimm/namespace_devs.c
> > @@ -1529,7 +1529,7 @@ static ssize_t __holder_class_store(struct device
> *dev, const char *buf)
> >  		return -EINVAL;
> >
> >  	/* btt_claim_class() could've returned an error */
> > -	if (ndns->claim_class < 0)
> > +	if ((int)ndns->claim_class < 0)
> >  		return ndns->claim_class;
> >
> >  	return 0;
> 
> Looks straightforward, and a good catch.
> Reviewed-by: Vishal Verma <vishal.l.verma@xxxxxxxxx>

I'm not sure this is really a good fix.  This leaves ndns->claim_class set to an invalid value.  Is that ok?

Ira





[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux