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: <fxqlcqxvcmfuviqtlkcd4qrhxf7xmcpuokkj4ebua2q4h36bkv@vgy53gbeqrdt>
Date: Mon, 8 Jul 2024 08:07:28 +0200
From: Uwe Kleine-König <u.kleine-koenig@...libre.com>
To: Nicolas Pitre <nico@...xnic.net>
Cc: Andrew Morton <akpm@...ux-foundation.org>, 
	Nicolas Pitre <npitre@...libre.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 1/2] mul_u64_u64_div_u64: make it precise always

On Sun, Jul 07, 2024 at 03:05:19PM -0400, Nicolas Pitre wrote:
> From: Nicolas Pitre <npitre@...libre.com>
> 
> Library facilities must always return exact results. If the caller may
> be contented with approximations then it should do the approximation on
> its own.
> 
> In this particular case the comment in the code says "the algorithm
> ... below might lose some precision". Well, if you try it with e.g.:
> 
> 	a = 18446462598732840960
> 	b = 18446462598732840960
> 	c = 18446462598732840961
> 
> then the produced answer is 0 whereas the exact answer should be
> 18446462598732840959. This is _some_ precision lost indeed!
> 
> Let's reimplement this function so it always produces the exact result
> regardless of its inputs while preserving existing fast paths
> when possible.
> 
> Signed-off-by: Nicolas Pitre <npitre@...libre.com>
> Tested-by: Uwe Kleine-König <u.kleine-koenig@...libre.com>
> Tested-by: Biju Das <biju.das.jz@...renesas.com>

I would have wished that parts of the conversation about v2 made it into
code comments. Anyhow, *I* have understood the code, so:

Reviewed-by: Uwe Kleine-König <u.kleine-koenig@...libre.com>

Best regards
Uwe

Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ