lkml.org 
[lkml]   [2006]   [Mar]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [patch 18/39] [PATCH] sys_mbind sanity checking
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 <chrisw@sous-sol.org>
> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
> [chrisw: fix units, pointed out by Andi]
> Cc: Andi Kleen <ak@suse.de>
> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
> ---
>
> 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 <davej@redhat.com>

--- 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 majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2006-03-02 05:19    [from the cache]
©2003-2014 Jasper Spaans. Advertise on this site