From: WANG Chao <chaowang@redhat.com>
To: "H. Peter Anvin" <hpa@zytor.com>
Cc: Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>,
x86@kernel.org (maintainer:X86 ARCHITECTURE...),
Matt Fleming <matt.fleming@intel.com>,
Andrew Morton <akpm@linux-foundation.org>,
Borislav Petkov <bp@suse.de>,
Santosh Shilimkar <santosh.shilimkar@ti.com>,
"Bryan O'Donoghue" <pure.logic@nexus-software.ie>,
linux-kernel@vger.kernel.org (open list:X86 ARCHITECTURE...)
Subject: [PATCH 1/2] x86: early_memremap exact size of struct setup_data
Date: Wed, 7 Jan 2015 18:55:48 +0800 [thread overview]
Message-ID: <1420628150-16872-1-git-send-email-chaowang@redhat.com> (raw)
When early remapping setup_data, we can remap the structure alone, use
sizeof(struct setup_data). No need to remap a larger area, we never
access setup_data->data at that point.
Signed-off-by: WANG Chao <chaowang@redhat.com>
---
arch/x86/kernel/setup.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index ab4734e..c4648ada 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -431,15 +431,13 @@ static void __init parse_setup_data(void)
pa_data = boot_params.hdr.setup_data;
while (pa_data) {
- u32 data_len, map_len, data_type;
+ u32 data_len, data_type;
- map_len = max(PAGE_SIZE - (pa_data & ~PAGE_MASK),
- (u64)sizeof(struct setup_data));
- data = early_memremap(pa_data, map_len);
+ data = early_memremap(pa_data, sizeof(*data));
data_len = data->len + sizeof(struct setup_data);
data_type = data->type;
pa_next = data->next;
- early_iounmap(data, map_len);
+ early_iounmap(data, sizeof(*data));
switch (data_type) {
case SETUP_E820_EXT:
--
2.1.0
next reply other threads:[~2015-01-07 10:56 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-07 10:55 WANG Chao [this message]
2015-01-07 10:55 ` [PATCH 2/2] x86: add macro for_each_setup_data() WANG Chao
2015-01-23 14:24 ` Thomas Gleixner
2015-01-23 15:18 ` [tip:x86/mm] x86, setup: Let early_memremap() handle page alignment tip-bot for WANG Chao
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=1420628150-16872-1-git-send-email-chaowang@redhat.com \
--to=chaowang@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=bp@suse.de \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=matt.fleming@intel.com \
--cc=mingo@redhat.com \
--cc=pure.logic@nexus-software.ie \
--cc=santosh.shilimkar@ti.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/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
Powered by JetHome