Re: [PATCH] x86, e820: clean up around sanitize_e820_map()
Hi, David On 01/21/15 at 02:51pm, David Rientjes wrote: > On Wed, 7 Jan 2015, WANG Chao wrote: > > > The argument 3 of sanitize_e820_map() will only update upon a successful > > sanitization. Some of the callers may not be aware of this in the past. > > Now clean up these callers. > > > > Signed-off-by: WANG Chao > > Nice, but it's incomplete: it should also cleanup > default_machine_specific_memory_setup(). default_machine_specific_memory_setup() is special. Because boot_params.e820_entries is 8bit unsigned, and sanitize_e820_map() which takes 32bit unsigned, will step on other member of boot_params next to e820_entries. Thanks WANG Chao -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] x86, e820: clean up around sanitize_e820_map()
On Wed, 7 Jan 2015, WANG Chao wrote: > The argument 3 of sanitize_e820_map() will only update upon a successful > sanitization. Some of the callers may not be aware of this in the past. > Now clean up these callers. > > Signed-off-by: WANG Chao Nice, but it's incomplete: it should also cleanup default_machine_specific_memory_setup(). After that's fixed, feel free to add my Acked-by: David Rientjes -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] x86, e820: clean up around sanitize_e820_map()
On Wed, 7 Jan 2015, WANG Chao wrote: The argument 3 of sanitize_e820_map() will only update upon a successful sanitization. Some of the callers may not be aware of this in the past. Now clean up these callers. Signed-off-by: WANG Chao chaow...@redhat.com Nice, but it's incomplete: it should also cleanup default_machine_specific_memory_setup(). After that's fixed, feel free to add my Acked-by: David Rientjes rient...@google.com -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] x86, e820: clean up around sanitize_e820_map()
Hi, David On 01/21/15 at 02:51pm, David Rientjes wrote: On Wed, 7 Jan 2015, WANG Chao wrote: The argument 3 of sanitize_e820_map() will only update upon a successful sanitization. Some of the callers may not be aware of this in the past. Now clean up these callers. Signed-off-by: WANG Chao chaow...@redhat.com Nice, but it's incomplete: it should also cleanup default_machine_specific_memory_setup(). default_machine_specific_memory_setup() is special. Because boot_params.e820_entries is 8bit unsigned, and sanitize_e820_map() which takes 32bit unsigned, will step on other member of boot_params next to e820_entries. Thanks WANG Chao -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] x86, e820: clean up around sanitize_e820_map()
The argument 3 of sanitize_e820_map() will only update upon a successful sanitization. Some of the callers may not be aware of this in the past. Now clean up these callers. Signed-off-by: WANG Chao --- arch/x86/kernel/e820.c | 22 ++ 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c index dd2f07a..ae70de8 100644 --- a/arch/x86/kernel/e820.c +++ b/arch/x86/kernel/e820.c @@ -185,7 +185,7 @@ void __init e820_print_map(char *who) * * The integer pointed to by pnr_map must be valid on entry (the * current number of valid entries located at biosmap) and will - * be updated on return, with the new number of valid entries + * only be updated on return 0, with the new number of valid entries * (something no more than max_nr_map.) * * The return value from sanitize_e820_map() is zero if it @@ -561,23 +561,15 @@ u64 __init e820_remove_range(u64 start, u64 size, unsigned old_type, void __init update_e820(void) { - u32 nr_map; - - nr_map = e820.nr_map; - if (sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), _map)) + if (sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), _map)) return; - e820.nr_map = nr_map; printk(KERN_INFO "e820: modified physical RAM map:\n"); e820_print_map("modified"); } static void __init update_e820_saved(void) { - u32 nr_map; - - nr_map = e820_saved.nr_map; - if (sanitize_e820_map(e820_saved.map, ARRAY_SIZE(e820_saved.map), _map)) - return; - e820_saved.nr_map = nr_map; + sanitize_e820_map(e820_saved.map, ARRAY_SIZE(e820_saved.map), + _saved.nr_map); } #define MAX_GAP_END 0x1ull /* @@ -898,11 +890,9 @@ early_param("memmap", parse_memmap_opt); void __init finish_e820_parsing(void) { if (userdef) { - u32 nr = e820.nr_map; - - if (sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), ) < 0) + if (sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), + _map) < 0) early_panic("Invalid user supplied memory map"); - e820.nr_map = nr; printk(KERN_INFO "e820: user-defined physical RAM map:\n"); e820_print_map("user"); -- 2.1.0 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] x86, e820: clean up around sanitize_e820_map()
The argument 3 of sanitize_e820_map() will only update upon a successful sanitization. Some of the callers may not be aware of this in the past. Now clean up these callers. Signed-off-by: WANG Chao chaow...@redhat.com --- arch/x86/kernel/e820.c | 22 ++ 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c index dd2f07a..ae70de8 100644 --- a/arch/x86/kernel/e820.c +++ b/arch/x86/kernel/e820.c @@ -185,7 +185,7 @@ void __init e820_print_map(char *who) * * The integer pointed to by pnr_map must be valid on entry (the * current number of valid entries located at biosmap) and will - * be updated on return, with the new number of valid entries + * only be updated on return 0, with the new number of valid entries * (something no more than max_nr_map.) * * The return value from sanitize_e820_map() is zero if it @@ -561,23 +561,15 @@ u64 __init e820_remove_range(u64 start, u64 size, unsigned old_type, void __init update_e820(void) { - u32 nr_map; - - nr_map = e820.nr_map; - if (sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), nr_map)) + if (sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), e820.nr_map)) return; - e820.nr_map = nr_map; printk(KERN_INFO e820: modified physical RAM map:\n); e820_print_map(modified); } static void __init update_e820_saved(void) { - u32 nr_map; - - nr_map = e820_saved.nr_map; - if (sanitize_e820_map(e820_saved.map, ARRAY_SIZE(e820_saved.map), nr_map)) - return; - e820_saved.nr_map = nr_map; + sanitize_e820_map(e820_saved.map, ARRAY_SIZE(e820_saved.map), + e820_saved.nr_map); } #define MAX_GAP_END 0x1ull /* @@ -898,11 +890,9 @@ early_param(memmap, parse_memmap_opt); void __init finish_e820_parsing(void) { if (userdef) { - u32 nr = e820.nr_map; - - if (sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), nr) 0) + if (sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), + e820.nr_map) 0) early_panic(Invalid user supplied memory map); - e820.nr_map = nr; printk(KERN_INFO e820: user-defined physical RAM map:\n); e820_print_map(user); -- 2.1.0 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/