lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 22 Dec 2021 14:13:35 -0500
From:   Liam Beguin <liambeguin@...il.com>
To:     Andy Shevchenko <andy.shevchenko@...il.com>
Cc:     Peter Rosin <peda@...ntia.se>, Jonathan Cameron <jic23@...nel.org>,
        Lars-Peter Clausen <lars@...afoo.de>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        linux-iio <linux-iio@...r.kernel.org>,
        devicetree <devicetree@...r.kernel.org>,
        Rob Herring <robh+dt@...nel.org>
Subject: Re: [PATCH v11 11/15] iio: test: add basic tests for the iio-rescale
 driver

On Wed, Dec 22, 2021 at 02:38:13PM +0200, Andy Shevchenko wrote:
> On Wed, Dec 22, 2021 at 5:47 AM Liam Beguin <liambeguin@...il.com> wrote:
> >
> > From: Liam Beguin <lvb@...hos.com>
> >
> > The iio-rescale driver supports various combinations of scale types and
> > offsets. These can often result in large integer multiplications. Make
> > sure these calculations are done right by adding a set of kunit test
> > cases that build on top of iio-test-format.
> 
> ...
> 
> > +       int fract_mult = 100000000LL;
> 
> Perhaps also change to use the prefix?

Argh.. I missed this file. Sorry, will update.

> ...
> 
> > +       *nano = (s64)tmp * 10 * fract_mult + tmp2;
> 
> I'm also puzzled what the meaning of the 10 is here?

That comes from iio_str_to_fixpoint().
I sould've added a comment to make it more explicit as details escape me
right now...  Will fix.

> ...
> 
> > +       err = 1000000 * abs(exp - real);
> 
> Prefix?

Ok

> ...
> 
> > +       err = div64_u64(err, abs(exp));
> > +       return (int)err;
> 
> return div64_u64();

will do.

Cheers,
Liam

> -- 
> With Best Regards,
> Andy Shevchenko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ