Re: [patch] i2c-scmi: remove some bogus NULL checks

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

 



On Wed, Oct 30, 2013 at 05:02:58PM +0100, Wolfram Sang wrote:
> > --- a/drivers/i2c/busses/i2c-scmi.c
> > +++ b/drivers/i2c/busses/i2c-scmi.c
> > @@ -223,7 +223,7 @@ acpi_smbus_cmi_access(struct i2c_adapter *adap, u16 addr, unsigned short flags,
> >  		goto out;
> >  
> >  	obj = pkg->package.elements + 1;
> > -	if (obj == NULL || obj->type != ACPI_TYPE_INTEGER) {
> > +	if (obj->type != ACPI_TYPE_INTEGER) {
> >  		ACPI_ERROR((AE_INFO, "Invalid argument type"));
> >  		result = -EIO;
> >  		goto out;

For obj to be 0 then pkg->package.elements must be -1.  If we're getting
a pointer of -1 then we're already screwed.  Also we already used
pkg->elements without the "+ 1" so we know that's not -1.

The reason for this patch was that some compilers assume pointer math
can't overflow and my checker was complaining.  We use
-fno-strict-overflow in the kernel, but it still seemed worth cleaning.

regards,
dan carpenter

--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[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