Messages in this thread Patch in this message | | | From | Minfei Huang <> | Subject | [PATCH] x86/mm: Give the correct initail value to the pmd_idx | Date | Thu, 6 Nov 2014 13:41:53 +0800 |
| |
The variable value is undefined from the stack eara. So it makes sense to init the variable to run process correctly.
If the variable pmd_idx inits the value more than PTRS_PER_PMD, the count may be smaller than the correct value, and the allocated page may be not enough for pte entry.
The kernel may panic cause by the undefine variable which is allocated from stack.
Signed-off-by: Minfei Huang <mnfhuang@gmail.com> --- arch/x86/mm/init_32.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c index c8140e1..c23ab1e 100644 --- a/arch/x86/mm/init_32.c +++ b/arch/x86/mm/init_32.c @@ -137,6 +137,7 @@ page_table_range_init_count(unsigned long start, unsigned long end) vaddr = start; pgd_idx = pgd_index(vaddr); + pmd_idx = pmd_index(vaddr); for ( ; (pgd_idx < PTRS_PER_PGD) && (vaddr != end); pgd_idx++) { for (; (pmd_idx < PTRS_PER_PMD) && (vaddr != end); -- 1.8.3.1
| |