* [PATCH] x86/mm: Give the correct initail value to the pmd_idx
@ 2014-11-06 5:41 Minfei Huang
2014-11-11 11:36 ` Minfei Huang
0 siblings, 1 reply; 2+ messages in thread
From: Minfei Huang @ 2014-11-06 5:41 UTC (permalink / raw)
To: tglx, mingo; +Cc: x86, linux-kernel, Minfei Huang
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] x86/mm: Give the correct initail value to the pmd_idx
2014-11-06 5:41 [PATCH] x86/mm: Give the correct initail value to the pmd_idx Minfei Huang
@ 2014-11-11 11:36 ` Minfei Huang
0 siblings, 0 replies; 2+ messages in thread
From: Minfei Huang @ 2014-11-11 11:36 UTC (permalink / raw)
To: Minfei Huang; +Cc: tglx, mingo, x86, hpa, linux-kernel
Could someone who help me review my patch?
Thanks
Minfei
On 11/06/14 at 01:41pm, Minfei Huang wrote:
> 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
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-11-11 11:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-06 5:41 [PATCH] x86/mm: Give the correct initail value to the pmd_idx Minfei Huang
2014-11-11 11:36 ` Minfei Huang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®