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] [day] [month] [year] [list]
Message-ID: <CAHp75Vda=ku6fm4kai=D3Vbu=uzEmKSN5o46gYhb9d5AUBELhQ@mail.gmail.com>
Date:   Fri, 10 Feb 2017 13:52:33 +0200
From:   Andy Shevchenko <andy.shevchenko@...il.com>
To:     Rajneesh Bhardwaj <rajneesh.bhardwaj@...el.com>
Cc:     Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        Platform Driver <platform-driver-x86@...r.kernel.org>,
        Shanth Murthy <shanth.murthy@...el.com>,
        Zha Qipeng <qipeng.zha@...el.com>,
        Darren Hart <dvhart@...radead.org>,
        Andy Shevchenko <andy@...radead.org>
Subject: Re: [PATCH v1] platform/x86: intel_pmc_ipc: fix division in 32-bit case

On Fri, Feb 10, 2017 at 6:24 AM, Rajneesh Bhardwaj
<rajneesh.bhardwaj@...el.com> wrote:
> On Wed, Feb 08, 2017 at 06:00:28PM +0200, Andy Shevchenko wrote:
>> On 32-bit x86 platforms we can't do 64-bit divisions:
>>
>>       ERROR: "__udivdi3" [drivers/platform/x86/intel_pmc_ipc.ko] undefined!
>>
>> Replace plain division by do_div() macro call.
>>
>> Reported-by: Darren Hart <dvhart@...radead.org>
>> Cc: Shanth Murthy <shanth.murthy@...el.com>
>> Cc: Rajneesh Bhardwaj <rajneesh.bhardwaj@...el.com>
>> Signed-off-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
>> ---
>>  drivers/platform/x86/intel_pmc_ipc.c | 7 ++++++-
>>  1 file changed, 6 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/platform/x86/intel_pmc_ipc.c b/drivers/platform/x86/intel_pmc_ipc.c
>> index 46202b6e7c87..8ad4d7b43423 100644
>> --- a/drivers/platform/x86/intel_pmc_ipc.c
>> +++ b/drivers/platform/x86/intel_pmc_ipc.c
>> @@ -62,7 +62,12 @@
>>  #define GCR_TELEM_SHLW_S0IX_OFFSET   0x1080
>>
>>  /* Residency with clock rate at 19.2MHz to usecs */
>> -#define S0IX_RESIDENCY_IN_USECS(d, s)                (((d) + (s)) * 10 / 192)
>> +#define S0IX_RESIDENCY_IN_USECS(d, s)                \
>> +({                                           \
>> +     u64 result = 10ull * ((d) + (s));       \
>> +     do_div(result, 192);                    \
>> +     result;                                 \
>> +})
>>
>
> Looks good, we verified it. We are planning to squash this one and send V2.
> Hope thats fine?

Please, do!

-- 
With Best Regards,
Andy Shevchenko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ