x86, e820: Guard against array overflowed in __e820_add_region()
authorCyrill Gorcunov <gorcunov@openvz.org>
Mon, 24 Aug 2009 17:53:37 +0000 (21:53 +0400)
committerIngo Molnar <mingo@elte.hu>
Wed, 26 Aug 2009 06:17:47 +0000 (08:17 +0200)
Better to be paranoid against unpredicted nr_map modifications.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
LKML-Reference: <20090824175551.146070377@openvz.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
arch/x86/kernel/e820.c

index 7271fa33d79135edd790f854d7c0c91d05d0c20b..2e5e0faa99b5a50f678d4df93333ca3e6b6e56e4 100644 (file)
@@ -115,7 +115,7 @@ static void __init __e820_add_region(struct e820map *e820x, u64 start, u64 size,
 {
        int x = e820x->nr_map;
 
-       if (x == ARRAY_SIZE(e820x->map)) {
+       if (x >= ARRAY_SIZE(e820x->map)) {
                printk(KERN_ERR "Ooops! Too many entries in the memory map!\n");
                return;
        }