From: Yinghai Lu <yhlu.kernel@gmail.com>
To: Ingo Molnar <mingo@elte.hu>, Thomas Gleixner <tglx@linutronix.de>,
"H. Peter Anvin" <hpa@zytor.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: [PATCH] x86: change size if e820_update/remove_range
Date: Tue, 24 Jun 2008 14:58:38 -0700 [thread overview]
Message-ID: <200806241458.38624.yhlu.kernel@gmail.com> (raw)
In-Reply-To: <200806241457.29607.yhlu.kernel@gmail.com>
in case someone using crazy parameter while calling them.
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.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;
prev parent reply other threads:[~2008-06-24 21:59 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-24 21:55 [PATCH] x86: fix e820_update_range size when overlapping Yinghai Lu
2008-06-24 21:56 ` [PATCH] x86: get max_pfn_mapped in init_memory_mapping Yinghai Lu
2008-06-24 21:57 ` [PATCH] x86: add table_top check for alloc_low_page in 64 bit Yinghai Lu
2008-06-24 21:58 ` Yinghai Lu [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200806241458.38624.yhlu.kernel@gmail.com \
--to=yhlu.kernel@gmail.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox