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: <8ECEC999-A742-488F-99B2-A076EF9CA2B2@toblux.com>
Date: Fri, 1 Mar 2024 13:28:00 +0100
From: Thorsten Blum <thorsten.blum@...lux.com>
To: David Laight <David.Laight@...LAB.COM>
Cc: Thomas Gleixner <tglx@...utronix.de>,
 Ingo Molnar <mingo@...hat.com>,
 Borislav Petkov <bp@...en8.de>,
 Dave Hansen <dave.hansen@...ux.intel.com>,
 "x86@...nel.org" <x86@...nel.org>,
 "H. Peter Anvin" <hpa@...or.com>,
 "Peter Zijlstra (Intel)" <peterz@...radead.org>,
 Wei Liu <wei.liu@...nel.org>,
 "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] x86/apic: Use div64_ul() instead of do_div()


> On Feb 29, 2024, at 23:13, David Laight <David.Laight@...LAB.COM> wrote:
> 
> do_div() does a 64 by 32 divide that gives a 32bit quotient.
> div64_ul() does a much more expensive 64 by 64 divide that
> can generate a 64bit quotient.

Since the dividend and the divisor could (according to the types at least) both
be 64-bit values and do_div() does a 64-by-32 division, the quotient could
potentially be wrong.

However, if the values don't require a 64-by-64 division (not even on a 64-bit
system) and the divisor (deltapm) is guaranteed to fit into 32 bits, wouldn't it
make sense to change its type from long to int?

Given that acpi_pm_read_early() returns a u32 and is then assigned to unsigned
long pm, this might be the source of the issue. Changing pm and deltapm from
long to u32 and keeping do_div() as is, would improve the types and remove the
Coccinelle warnings...but maybe I'm missing something?

Thanks,
Thorsten

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ