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]
Date:   Thu, 10 Feb 2022 09:48:44 +0000
From:   David Laight <David.Laight@...LAB.COM>
To:     'Uwe Kleine-König' 
        <u.kleine-koenig@...gutronix.de>, Qing Wang <wangqing@...o.com>
CC:     Thierry Reding <thierry.reding@...il.com>,
        Lee Jones <lee.jones@...aro.org>,
        "linux-pwm@...r.kernel.org" <linux-pwm@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH] pwm: use div64_u64() instead of do_div()

From: Uwe Kleine-König
> Sent: 09 February 2022 15:26
...
> > -	do_div(cycles, period_ns);
> > +	div64_u64(cycles, period_ns);
> 
> This is wrong, div64_u64() has a different calling convention than do_div().
> 
> The issue however is real. Please add

Not really although I can't see a check I'd assume that period_ns
is expected to be much less than a second - so well under 32 bits
There is certainly a general expectation that multiplying by
other 'largish' values won't exceed 64 bits.

Plausible the pwm 'period' should actually be a u32.
But then care would be needed to ensure the multiplies have
64bit results.

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ