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:	Sun, 27 Dec 2009 09:30:04 -0600
From:	James Bottomley <James.Bottomley@...senPartnership.com>
To:	Roel Kluin <roel.kluin@...il.com>
Cc:	Kyle McMartin <kyle@...artin.ca>, Helge Deller <deller@....de>,
	"James E.J. Bottomley" <jejb@...isc-linux.org>,
	linux-parisc@...r.kernel.org,
	Andrew Morton <akpm@...ux-foundation.org>,
	LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] parisc: test off by one in sgl_frem() and dbl_frem()

On Sun, 2009-12-27 at 14:21 +0100, Roel Kluin wrote:
> With `while (stepcount-- > 0)' stepcount reaches -1 after the loop.

This is true, but seems to be by design

> Signed-off-by: Roel Kluin <roel.kluin@...il.com>
> ---
>  arch/parisc/math-emu/dfrem.c |    2 +-
>  arch/parisc/math-emu/sfrem.c |    2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> Unless I am missing something?
> 
> diff --git a/arch/parisc/math-emu/dfrem.c b/arch/parisc/math-emu/dfrem.c
> index b983785..3283445 100644
> --- a/arch/parisc/math-emu/dfrem.c
> +++ b/arch/parisc/math-emu/dfrem.c
> @@ -234,7 +234,7 @@ dbl_frem (dbl_floating_point * srcptr1, dbl_floating_point * srcptr2,
>  		Dbl_subtract(opnd1p1,opnd1p2,opnd2p1,opnd2p2,opnd1p1,opnd1p2);
>  		roundup = TRUE;
>  	}
> -	if (stepcount > 0 || Dbl_iszero(opnd1p1,opnd1p2)) {
> +	if (stepcount >= 0 || Dbl_iszero(opnd1p1,opnd1p2)) {
>  		/* division is exact, remainder is zero */
>  		Dbl_setzero_exponentmantissa(resultp1,resultp2);
>  		Dbl_copytoptr(resultp1,resultp2,dstptr);
> diff --git a/arch/parisc/math-emu/sfrem.c b/arch/parisc/math-emu/sfrem.c
> index 3a1b7a3..ad87832 100644
> --- a/arch/parisc/math-emu/sfrem.c
> +++ b/arch/parisc/math-emu/sfrem.c
> @@ -229,7 +229,7 @@ sgl_frem (sgl_floating_point * srcptr1, sgl_floating_point * srcptr2,
>  		Sgl_subtract(opnd1,opnd2,opnd1);
>  		roundup = TRUE;
>  	}
> -	if (stepcount > 0 || Sgl_iszero(opnd1)) {
> +	if (stepcount >= 0 || Sgl_iszero(opnd1)) {
>  		/* division is exact, remainder is zero */
>  		Sgl_setzero_exponentmantissa(result);
>  		*dstptr = result;

Your patch does nothing to the actual execution flow (Sgl_iszero is true
if stepcount == 0) ... what's the point of applying it?

James


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists