OSDN Git Service

[PATCH] i386: fix overflow in vmap on an x86 system which has more than 4GB memory.
authorMichael Chen <micche@ati.com>
Sat, 23 Sep 2006 17:26:26 +0000 (18:26 +0100)
committerWilly Tarreau <w@1wt.eu>
Thu, 28 Sep 2006 21:20:38 +0000 (23:20 +0200)
(max_mapnr << PAGE_SHIFT) would overflow on a system which has
4GB memory or more, and so could cause vmap to fail every time.

Signed-off-by: Michael Chen <micche@ati.com>
Signed-off-by: Hugh Dickins <hugh@veritas.com>
mm/vmalloc.c

index 4d2a93a..bda5090 100644 (file)
@@ -293,7 +293,7 @@ void * vmap(struct page **pages, int count,
        struct vm_struct *area;
        unsigned long size = count << PAGE_SHIFT;
 
-       if (!size || size > (max_mapnr << PAGE_SHIFT))
+       if (count <= 0 || count > max_mapnr)
                return NULL;
        area = get_vm_area(size, flags);
        if (!area) {