lkml.org 
[lkml]   [2019]   [Oct]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] iio: imu: adis16480: clean up a condition
On Sun, Oct 06, 2019 at 09:51:33AM +0100, Jonathan Cameron wrote:
> On Thu, 26 Sep 2019 14:36:30 +0300
> Dan Carpenter <dan.carpenter@oracle.com> wrote:
>
> > On Thu, Sep 26, 2019 at 11:06:39AM +0000, Ardelean, Alexandru wrote:
> > > On Thu, 2019-09-26 at 11:10 +0300, Dan Carpenter wrote:
> > > > [External]
> > > >
> > > > The "t" variable is unsigned so it can't be less than zero. We really
> > > > are just trying to prevent divide by zero bugs so just checking against
> > > > zero is sufficient.
>
> I'm not sure that true. It if were signed we'd be detecting that the
> input from userspace was negative.

It does a really bad job of that though so it raises more questions than
answers. Maybe just one of the parameters is negative or maybe the
multiply or the addition overflowed? Should scenarios those be checked?

It turns out none of those situations matter, only divide by zero needs
to be checked.

regards,
dan carpenter




\
 
 \ /
  Last update: 2019-10-06 20:17    [W:0.084 / U:0.064 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site