提交 5051fd69 编写于 作者: C Cyrill Gorcunov 提交者: Ingo Molnar

x86, e820: Guard against array overflowed in __e820_add_region()

Better to be paranoid against unpredicted nr_map modifications.
Signed-off-by: NCyrill Gorcunov <gorcunov@openvz.org>
LKML-Reference: <20090824175551.146070377@openvz.org>
Signed-off-by: NIngo Molnar <mingo@elte.hu>
上级 2495fbf7
...@@ -115,7 +115,7 @@ static void __init __e820_add_region(struct e820map *e820x, u64 start, u64 size, ...@@ -115,7 +115,7 @@ static void __init __e820_add_region(struct e820map *e820x, u64 start, u64 size,
{ {
int x = e820x->nr_map; 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"); printk(KERN_ERR "Ooops! Too many entries in the memory map!\n");
return; return;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册