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:	Mon, 12 Dec 2011 15:50:11 -0800
From:	Linus Torvalds <torvalds@...ux-foundation.org>
To:	Dmitry Torokhov <dtor@...are.com>
Cc:	linux-kernel@...r.kernel.org,
	Andrew Morton <akpm@...ux-foundation.org>,
	pv-drivers@...are.com, Andrei Warkentin <andreiw@...are.com>,
	stable@...nel.org, Jesper Juhl <jj@...osbits.net>,
	Rolf Eike Beer <eike-kernel@...tec.de>
Subject: Re: [PATCH] include/log2.h: Fix rounddown_pow_of_two(1)

On Mon, Dec 12, 2011 at 10:02 AM, Dmitry Torokhov <dtor@...are.com> wrote:
> From: Andrei Warkentin <andreiw@...are.com>
>
> 1 is a power of two, therefore rounddown_pow_of_two(1) should return 1.
> It does in case the argument is a variable but in case it's a constant
> it behaves incorrectly and returns 0. Probably nobody ever did it so
> this was never noticed, however drivers/net/vmxnet3 with latest GCC does
> and breaks on unicpu systems.
>
> This is similar to Rolf's patch to roundup_pow_of_two(1).

Umm. I already applied this patch, but then I started looking at it
more, and asked myself:

 - Why is that "n == 1" test there AT ALL?

Afaik, that whole test is just plain stupid. It seems to have been
copied from the "roundup()" case (where it exists due to the "-1/+1"
hackery that breaks ilog2()) without any thought about the actual math
of the function at all.

I think the *real* fix is to just remove that incorrect line, no?

It's a bit sad that we apparently have several reviewers for this
trivial patch, and nobody reacted to the math just not making any
sense.

                                      Linus
--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ