[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <200806241458.38624.yhlu.kernel@gmail.com>
Date: Tue, 24 Jun 2008 14:58:38 -0700
From: Yinghai Lu <yhlu.kernel@...il.com>
To: Ingo Molnar <mingo@...e.hu>, Thomas Gleixner <tglx@...utronix.de>,
"H. Peter Anvin" <hpa@...or.com>
Cc: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: [PATCH] x86: change size if e820_update/remove_range
in case someone using crazy parameter while calling them.
Signed-off-by: Yinghai Lu <yhlu.kernel@...il.com>
diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c
index 512f779..6445220 100644
--- a/arch/x86/kernel/e820.c
+++ b/arch/x86/kernel/e820.c
@@ -405,6 +405,9 @@ u64 __init e820_update_range(u64 start, u64 size, unsigned old_type,
BUG_ON(old_type == new_type);
+ if (size > (ULLONG_MAX - start))
+ size = ULLONG_MAX - start;
+
for (i = 0; i < e820.nr_map; i++) {
struct e820entry *ei = &e820.map[i];
u64 final_start, final_end;
@@ -436,6 +439,9 @@ u64 __init e820_remove_range(u64 start, u64 size, unsigned old_type,
int i;
u64 real_removed_size = 0;
+ if (size > (ULLONG_MAX - start))
+ size = ULLONG_MAX - start;
+
for (i = 0; i < e820.nr_map; i++) {
struct e820entry *ei = &e820.map[i];
u64 final_start, final_end;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists