summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Braun <rbraun@sceen.net>2017-09-27 09:11:14 +0200
committerRichard Braun <rbraun@sceen.net>2017-09-27 09:11:14 +0200
commit660d1df655bcd56f46d3e7a8b20b061eecb9843a (patch)
tree52bda94c4d56a909b587e587e588f2ec5ad9397e
parent379e4f61fed78469caf16635b394bf128d11b6b0 (diff)
x86/pmap: add assertion on CPU ID
-rw-r--r--arch/x86/machine/pmap.c5
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