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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <eb59f405-24c6-69b8-beb1-465bfb783f61@collabora.com>
Date:   Thu, 23 Dec 2021 21:34:30 +0500
From:   Muhammad Usama Anjum <usama.anjum@...labora.com>
To:     Andy Shevchenko <andy.shevchenko@...il.com>
Cc:     Lars-Peter Clausen <lars@...afoo.de>,
        Michael Hennerich <Michael.Hennerich@...log.com>,
        Jonathan Cameron <jic23@...nel.org>,
        Mihail Chindris <mihail.chindris@...log.com>,
        "open list:IIO SUBSYSTEM AND DRIVERS" <linux-iio@...r.kernel.org>,
        open list <linux-kernel@...r.kernel.org>,
        Collabora Kernel ML <kernel@...labora.com>,
        kernel-janitors <kernel-janitors@...r.kernel.org>
Subject: Re: [PATCH] drivers:iio:dac make expression evaluation 64-bit

On 12/22/21 11:49 PM, Andy Shevchenko wrote:
> On Wed, Dec 22, 2021 at 5:59 PM Muhammad Usama Anjum
> <usama.anjum@...labora.com> wrote:
>>
>> Two 32-bit values are being evaluated using 32-bit arithmetic and then
>> passed to s64 type. It is wrong. Expression should be evaluated using
>> 64-bit arithmetic and then passed.
> 
> ...
> 
>>         dac->ch_data[ch].scale_dec = DIV_ROUND_CLOSEST((s64)rem * 1000000,
>>                                                         65536);
> 
> Shouldn't the above be fixed as well? Has anybody tried to compile on
> 32-bit arch this?
No, it correct already. In this case, rem is being typecasted to s64 and
then multiplied with a 32-bit number, 1000000. Thus 64-bit arithmetic is
being performed here.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ