]>
Commit | Line | Data |
---|---|---|
59d5af67 | 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 |
321d628a FG |
2 | From: Baoquan He <bhe@redhat.com> |
3 | Date: Sat, 28 Oct 2017 09:30:38 +0800 | |
59d5af67 FG |
4 | Subject: [PATCH] x86/mm/64: Rename the register_page_bootmem_memmap() 'size' |
5 | parameter to 'nr_pages' | |
321d628a FG |
6 | MIME-Version: 1.0 |
7 | Content-Type: text/plain; charset=UTF-8 | |
8 | Content-Transfer-Encoding: 8bit | |
9 | ||
10 | CVE-2017-5754 | |
11 | ||
12 | register_page_bootmem_memmap()'s 3rd 'size' parameter is named | |
13 | in a somewhat misleading fashion - rename it to 'nr_pages' which | |
14 | makes the units of it much clearer. | |
15 | ||
16 | Meanwhile rename the existing local variable 'nr_pages' to | |
17 | 'nr_pmd_pages', a more expressive name, to avoid conflict with | |
18 | new function parameter 'nr_pages'. | |
19 | ||
20 | (Also clean up the unnecessary parentheses in which get_order() is called.) | |
21 | ||
22 | Signed-off-by: Baoquan He <bhe@redhat.com> | |
23 | Acked-by: Thomas Gleixner <tglx@linutronix.de> | |
24 | Cc: Linus Torvalds <torvalds@linux-foundation.org> | |
25 | Cc: Peter Zijlstra <peterz@infradead.org> | |
26 | Cc: akpm@linux-foundation.org | |
27 | Link: http://lkml.kernel.org/r/1509154238-23250-1-git-send-email-bhe@redhat.com | |
28 | Signed-off-by: Ingo Molnar <mingo@kernel.org> | |
29 | (cherry picked from commit 15670bfe19905b1dcbb63137f40d718b59d84479) | |
30 | Signed-off-by: Andy Whitcroft <apw@canonical.com> | |
31 | Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com> | |
32 | (cherry picked from commit d73ad1d31ef8a44c6e5977c5123cbaa6d02e2035) | |
33 | Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com> | |
34 | --- | |
35 | include/linux/mm.h | 2 +- | |
36 | arch/x86/mm/init_64.c | 10 +++++----- | |
37 | 2 files changed, 6 insertions(+), 6 deletions(-) | |
38 | ||
39 | diff --git a/include/linux/mm.h b/include/linux/mm.h | |
40 | index 07630442bbf2..97f6ca707010 100644 | |
41 | --- a/include/linux/mm.h | |
42 | +++ b/include/linux/mm.h | |
43 | @@ -2475,7 +2475,7 @@ void vmemmap_populate_print_last(void); | |
44 | void vmemmap_free(unsigned long start, unsigned long end); | |
45 | #endif | |
46 | void register_page_bootmem_memmap(unsigned long section_nr, struct page *map, | |
47 | - unsigned long size); | |
48 | + unsigned long nr_pages); | |
49 | ||
50 | enum mf_flags { | |
51 | MF_COUNT_INCREASED = 1 << 0, | |
52 | diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c | |
53 | index 136422d7d539..902983c8ea8c 100644 | |
54 | --- a/arch/x86/mm/init_64.c | |
55 | +++ b/arch/x86/mm/init_64.c | |
56 | @@ -1418,16 +1418,16 @@ int __meminit vmemmap_populate(unsigned long start, unsigned long end, int node) | |
57 | ||
58 | #if defined(CONFIG_MEMORY_HOTPLUG_SPARSE) && defined(CONFIG_HAVE_BOOTMEM_INFO_NODE) | |
59 | void register_page_bootmem_memmap(unsigned long section_nr, | |
60 | - struct page *start_page, unsigned long size) | |
61 | + struct page *start_page, unsigned long nr_pages) | |
62 | { | |
63 | unsigned long addr = (unsigned long)start_page; | |
64 | - unsigned long end = (unsigned long)(start_page + size); | |
65 | + unsigned long end = (unsigned long)(start_page + nr_pages); | |
66 | unsigned long next; | |
67 | pgd_t *pgd; | |
68 | p4d_t *p4d; | |
69 | pud_t *pud; | |
70 | pmd_t *pmd; | |
71 | - unsigned int nr_pages; | |
72 | + unsigned int nr_pmd_pages; | |
73 | struct page *page; | |
74 | ||
75 | for (; addr < end; addr = next) { | |
76 | @@ -1474,9 +1474,9 @@ void register_page_bootmem_memmap(unsigned long section_nr, | |
77 | if (pmd_none(*pmd)) | |
78 | continue; | |
79 | ||
80 | - nr_pages = 1 << (get_order(PMD_SIZE)); | |
81 | + nr_pmd_pages = 1 << get_order(PMD_SIZE); | |
82 | page = pmd_page(*pmd); | |
83 | - while (nr_pages--) | |
84 | + while (nr_pmd_pages--) | |
85 | get_page_bootmem(section_nr, page++, | |
86 | SECTION_INFO); | |
87 | } | |
88 | -- | |
89 | 2.14.2 | |
90 |