mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-15 08:14:15 +08:00
x86, e820: Guard against array overflowed in __e820_add_region()
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>
This commit is contained in:
parent
2495fbf7ef
commit
5051fd6977
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user