Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'x86-mm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull x86 mm cleanups from Ingo Molnar:
"Two cleanups: simplify parse_setup_data() and sanitize_e820_map()
usage"

* 'x86-mm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
x86, e820: Clean up sanitize_e820_map() users
x86, setup: Let early_memremap() handle page alignment

+11 -23
+8 -18
arch/x86/kernel/e820.c
··· 184 184 * overwritten in the same location, starting at biosmap. 185 185 * 186 186 * The integer pointed to by pnr_map must be valid on entry (the 187 - * current number of valid entries located at biosmap) and will 188 - * be updated on return, with the new number of valid entries 189 - * (something no more than max_nr_map.) 187 + * current number of valid entries located at biosmap). If the 188 + * sanitizing succeeds the *pnr_map will be updated with the new 189 + * number of valid entries (something no more than max_nr_map). 190 190 * 191 191 * The return value from sanitize_e820_map() is zero if it 192 192 * successfully 'sanitized' the map entries passed in, and is -1 ··· 561 561 562 562 void __init update_e820(void) 563 563 { 564 - u32 nr_map; 565 - 566 - nr_map = e820.nr_map; 567 - if (sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &nr_map)) 564 + if (sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map)) 568 565 return; 569 - e820.nr_map = nr_map; 570 566 printk(KERN_INFO "e820: modified physical RAM map:\n"); 571 567 e820_print_map("modified"); 572 568 } 573 569 static void __init update_e820_saved(void) 574 570 { 575 - u32 nr_map; 576 - 577 - nr_map = e820_saved.nr_map; 578 - if (sanitize_e820_map(e820_saved.map, ARRAY_SIZE(e820_saved.map), &nr_map)) 579 - return; 580 - e820_saved.nr_map = nr_map; 571 + sanitize_e820_map(e820_saved.map, ARRAY_SIZE(e820_saved.map), 572 + &e820_saved.nr_map); 581 573 } 582 574 #define MAX_GAP_END 0x100000000ull 583 575 /* ··· 890 898 void __init finish_e820_parsing(void) 891 899 { 892 900 if (userdef) { 893 - u32 nr = e820.nr_map; 894 - 895 - if (sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &nr) < 0) 901 + if (sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), 902 + &e820.nr_map) < 0) 896 903 early_panic("Invalid user supplied memory map"); 897 - e820.nr_map = nr; 898 904 899 905 printk(KERN_INFO "e820: user-defined physical RAM map:\n"); 900 906 e820_print_map("user");
+3 -5
arch/x86/kernel/setup.c
··· 431 431 432 432 pa_data = boot_params.hdr.setup_data; 433 433 while (pa_data) { 434 - u32 data_len, map_len, data_type; 434 + u32 data_len, data_type; 435 435 436 - map_len = max(PAGE_SIZE - (pa_data & ~PAGE_MASK), 437 - (u64)sizeof(struct setup_data)); 438 - data = early_memremap(pa_data, map_len); 436 + data = early_memremap(pa_data, sizeof(*data)); 439 437 data_len = data->len + sizeof(struct setup_data); 440 438 data_type = data->type; 441 439 pa_next = data->next; 442 - early_iounmap(data, map_len); 440 + early_iounmap(data, sizeof(*data)); 443 441 444 442 switch (data_type) { 445 443 case SETUP_E820_EXT: