Re: [PATCH v2] staging: iio: tsl2x7x: clean up limit checks

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

 



On Sat, 16 Sep 2017 14:18:52 +0200
Paolo Cretaro <melko@xxxxxxxxxxxxxx> wrote:

> On 16/09/2017 13:37, Dan Carpenter wrote:
> > On Sat, Sep 16, 2017 at 01:11:29PM +0200, Paolo Cretaro wrote:  
> >> Hi Dan,
> >> just minor nitpicking on the commit message:
> >>
> >> On 08/09/2017 12:53, Dan Carpenter wrote:  
> >>> The background of this code is that we can either use the default
> >>> tables or load our own table with sysfs.  The default tables are three
> >>> element arrays of struct tsl2x7x_lux.  If we load the table with sysfs
> >>> then we can have as many as nine elements.  Which ever way we do it, the
> >>> last element is always zeroed out.
> >>>
> >>> The most interesting part of this patch is in the
> >>> in_illuminance0_lux_table_show() function.  We were using the wrong
> >>> limit, "TSL2X7X_MAX_LUX_TABLE_SIZE * 3", when it should have been just
> >>> "TSL2X7X_MAX_LUX_TABLE_SIZE".  This creates a static checker warning
> >>> that we are going of of bounds.  However, since the last element is  
> >> out of bounds
> >>
> >> Regards,
> >> P.
> >>  
> >>> always zeroed out, that means we hit the break statement and the code
> >>> works correctly despite the wrong limit check.  
> > 
> > What?  No no.  I meant it how I wrote it.  The last element is
> > always zeroed out meaning it's just a series of zeroes.  
> 
> Sorry, I meant the previous sentence "This creates a static checker warning
> that we are going of of bounds".

Double of fixed and patch applied to the togreg branch of iio.git.

Thanks,

Jonathan
> 
> Regards,
> P.
> 
> > 
> > regards,
> > dan carpenter
> >   
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux