diff options
author | Richard Braun <rbraun@sceen.net> | 2017-09-27 09:11:14 +0200 |
---|---|---|
committer | Richard Braun <rbraun@sceen.net> | 2017-09-27 09:11:14 +0200 |
commit | 660d1df655bcd56f46d3e7a8b20b061eecb9843a (patch) | |
tree | 52bda94c4d56a909b587e587e588f2ec5ad9397e | |
parent | 379e4f61fed78469caf16635b394bf128d11b6b0 (diff) |
x86/pmap: add assertion on CPU ID
-rw-r--r-- | arch/x86/machine/pmap.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/arch/x86/machine/pmap.c b/arch/x86/machine/pmap.c index 0448d07d..6d424966 100644 --- a/arch/x86/machine/pmap.c +++ b/arch/x86/machine/pmap.c @@ -999,9 +999,10 @@ pmap_copy_cpu_table(unsigned int cpu) assert(cpu != 0); - cpu_table = pmap_get_kernel_pmap()->cpu_tables[cpu]; - level = PMAP_NR_LEVELS - 1; kernel_pmap = pmap_get_kernel_pmap(); + assert(cpu < ARRAY_SIZE(kernel_pmap->cpu_tables)); + cpu_table = kernel_pmap->cpu_tables[cpu]; + level = PMAP_NR_LEVELS - 1; sptp = pmap_ptp_from_pa(kernel_pmap->cpu_tables[cpu_id()]->root_ptp_pa); #ifdef CONFIG_X86_PAE |