x86: fix e820_update_range size when overlapping
authorYinghai Lu <yhlu.kernel@gmail.com>
Tue, 24 Jun 2008 21:55:32 +0000 (14:55 -0700)
committerIngo Molnar <mingo@elte.hu>
Tue, 8 Jul 2008 11:10:34 +0000 (13:10 +0200)
before that we relay on sanitize_e820_map to remove the overlap.

but e820_update_range(,,E820_RESERVED, E820_RAM) will not work

this patch fix that

who is going to use this?

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
arch/x86/kernel/e820.c

index 512f779fc6af23d11713107df4694f9df7f9b921..15b4393ff9bf8964efefab1e7de4068c0db96ceb 100644 (file)
@@ -425,6 +425,11 @@ u64 __init e820_update_range(u64 start, u64 size, unsigned old_type,
                e820_add_region(final_start, final_end - final_start,
                                         new_type);
                real_updated_size += final_end - final_start;
+
+               ei->size -= final_end - final_start;
+               if (ei->addr < final_start)
+                       continue;
+               ei->addr = final_end;
        }
        return real_updated_size;
 }