mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/2] x86: early_memremap exact size of struct setup_data
@ 2015-01-07 10:55 WANG Chao
  2015-01-07 10:55 ` [PATCH 2/2] x86: add macro for_each_setup_data() WANG Chao
  2015-01-23 15:18 ` [tip:x86/mm] x86, setup: Let early_memremap() handle page alignment tip-bot for WANG Chao
  0 siblings, 2 replies; 4+ messages in thread
From: WANG Chao @ 2015-01-07 10:55 UTC (permalink / raw)
  To: H. Peter Anvin
  Cc: Thomas Gleixner, Ingo Molnar, maintainer:X86 ARCHITECTURE...,
	Matt Fleming, Andrew Morton, Borislav Petkov, Santosh Shilimkar,
	Bryan O'Donoghue, open list:X86 ARCHITECTURE...

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-01-23 15:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-07 10:55 [PATCH 1/2] x86: early_memremap exact size of struct setup_data WANG Chao
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

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