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: <a05adc0e-35f8-9e77-9e3e-83de851b651b@amazon.com>
Date:   Thu, 1 Sep 2022 15:47:39 +0300
From:   "Farber, Eliav" <farbere@...zon.com>
To:     Andy Shevchenko <andriy.shevchenko@...el.com>
CC:     <jdelvare@...e.com>, <linux@...ck-us.net>, <robh+dt@...nel.org>,
        <p.zabel@...gutronix.de>, <rtanwar@...linear.com>,
        <linux-hwmon@...r.kernel.org>, <devicetree@...r.kernel.org>,
        <linux-kernel@...r.kernel.org>, <talel@...zon.com>,
        <hhhawa@...zon.com>, <jonnyc@...zon.com>, <hanochu@...zon.com>,
        <ronenk@...zon.com>, <itamark@...zon.com>, <shellykz@...zon.com>,
        <shorer@...zon.com>, <amitlavi@...zon.com>, <almogbs@...zon.com>,
        <dkl@...zon.com>, "Farber, Eliav" <farbere@...zon.com>
Subject: Re: [PATCH v3 12/19] hwmon: (mr75203) fix voltage equation for negative
 source input

On 8/31/2022 3:04 PM, Andy Shevchenko wrote:
> On Tue, Aug 30, 2022 at 07:22:05PM +0000, Eliav Farber wrote:
>> According to Moortec Embedded Voltage Monitor (MEVM) series 3 data 
>> sheet,
>> the minimum input signal is -100mv and maximum input signal is +1000mv.
>> When n was small enough, such that PVT_N_CONST * n < PVT_R_CONST it
>> resulted in n overflowing to a very large number (since n is u32 type).
>>
>> This change fixes the problem by casting n to long and replacing shift
>> right with div operation.
>
> Fixes tag?

For v4 I modified the commit message to (hopefully) be more
understandable:

"
According to Moortec Embedded Voltage Monitor (MEVM) series 3 data
sheet, the minimum input signal is -100mv and maximum input signal
is +1000mv.

On 64 bit machines sizeof(u32) = 4 and sizeof(long) = 8.
So when measuring a negative input and n is small enough, such that
PVT_N_CONST * n < PVT_R_CONST, it results in n overflowing to a very
large number which is not negative (because 4 MSB bytes of val are 0).

This change fixes the sign problem and supports negative values by
casting n to long and replacing shift right with div operation.
"


> ...
>
>>               n &= SAMPLE_DATA_MSK;
>> +
>
> Unrelated change.

Removed.

--
Thanks, Eliav

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ