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] [day] [month] [year] [list]
Date:	Mon, 07 Jul 2014 16:45:38 -0700
From:	Joe Perches <joe@...ches.com>
To:	Andrew Morton <akpm@...ux-foundation.org>
Cc:	Rasmus Villemoes <linux@...musvillemoes.dk>,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 00/18] lib: bitmap: Various improvements

On Mon, 2014-07-07 at 16:20 -0700, Andrew Morton wrote:
> On Fri,  4 Jul 2014 00:42:46 +0200 Rasmus Villemoes <linux@...musvillemoes.dk> wrote:
> 
> > Many functions in lib/bitmap.c start with an expression such as lim =
> > bits/BITS_PER_LONG. Since bits has type (signed) int, and since gcc
> > cannot know that it is in fact non-negative, it generates worse code
> > than it could. These patches, mostly consisting of changing various
> > parameters to unsigned, gives a slight overall code reduction:
> 
> Yes, we have a bad habit of using signed types for things where
> negative values are absurd.

Linus at one time wrote:
http://thread.gmane.org/gmane.linux.kernel/1526174

---------------------------------------------------------
The fact is, the x86 bitop instructions act on a
signed index. Making the index be "unsigned long" would violate the
actual *behavior* of the function, so it would be singularly stupid.
---------------------------------------------------------

> The patches look OK to me.

Me too.

But this does have the unfortunate effect of allowing
bitmap tests on bitmaps that are unable to be set/cleared
when the bitmap is larger than INT_MAX size.

There could be some check to make sure size <= INT_MAX.

The docs could be clearer here too about the actual
maximum size of a bitmap.


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