On Mon, Feb 27, 2006 at 02:32:18PM -0800, Chris Wright wrote:
> -stable review patch. If anyone has any objections, please let us know.
> ------------------
>
> Make sure maxnodes is safe size before calculating nlongs in
> get_nodes().
>
> Signed-off-by: Chris Wright <[email protected]>
> Signed-off-by: Linus Torvalds <[email protected]>
> [chrisw: fix units, pointed out by Andi]
> Cc: Andi Kleen <[email protected]>
> Signed-off-by: Greg Kroah-Hartman <[email protected]>
> ---
>
> mm/mempolicy.c | 2 ++
> 1 files changed, 2 insertions(+)
>
> --- linux-2.6.15.4.orig/mm/mempolicy.c
> +++ linux-2.6.15.4/mm/mempolicy.c
> @@ -524,6 +524,8 @@ static int get_nodes(nodemask_t *nodes,
> nodes_clear(*nodes);
> if (maxnode == 0 || !nmask)
> return 0;
> + if (maxnode > PAGE_SIZE*BITS_PER_BYTE)
> + return -EINVAL;
>
> nlongs = BITS_TO_LONGS(maxnode);
> if ((maxnode % BITS_PER_LONG) == 0)
Gar..
mm/mempolicy.c: In function 'get_nodes':
mm/mempolicy.c:527: error: 'BITS_PER_BYTE' undeclared (first use in this function)
mm/mempolicy.c:527: error: (Each undeclared identifier is reported only once
mm/mempolicy.c:527: error: for each function it appears in.)
About to retry a build with the below patch which should do the trick.
(How did this *ever* build?)
Signed-off-by: Dave Jones <[email protected]>
--- linux-2.6.15/include/linux/types.h~ 2006-03-01 23:05:24.000000000 -0500
+++ linux-2.6.15/include/linux/types.h 2006-03-01 23:05:57.000000000 -0500
@@ -8,6 +8,7 @@
(((bits)+BITS_PER_LONG-1)/BITS_PER_LONG)
#define DECLARE_BITMAP(name,bits) \
unsigned long name[BITS_TO_LONGS(bits)]
+#define BITS_PER_BYTE 8
#endif
#include <linux/posix_types.h>
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]