aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/include/asm/book3s/64/mmu-hash.h
diff options
context:
space:
mode:
authorMichael Ellerman <mpe@ellerman.id.au>2017-03-29 23:10:34 +1100
committerMichael Ellerman <mpe@ellerman.id.au>2017-03-31 23:09:59 +1100
commit85beb1c486df76a7a851a0e063785282c2608f37 (patch)
treeda13f327c397a15d75ec0790bc143d9c790b4f23 /arch/powerpc/include/asm/book3s/64/mmu-hash.h
parentpowerpc/mm/hash: Use context ids 1-4 for the kernel (diff)
downloadlinux-dev-85beb1c486df76a7a851a0e063785282c2608f37.tar.xz
linux-dev-85beb1c486df76a7a851a0e063785282c2608f37.zip
powerpc/mm/hash: Check for non-kernel address in get_kernel_vsid()
get_kernel_vsid() has a very stern comment saying that it's only valid for kernel addresses, but there's nothing in the code to enforce that. Rather than hoping our callers are well behaved, add a check and return a VSID of 0 (invalid). Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Diffstat (limited to 'arch/powerpc/include/asm/book3s/64/mmu-hash.h')
-rw-r--r--arch/powerpc/include/asm/book3s/64/mmu-hash.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/arch/powerpc/include/asm/book3s/64/mmu-hash.h b/arch/powerpc/include/asm/book3s/64/mmu-hash.h
index a5ab6f5b8a7f..10a34282829e 100644
--- a/arch/powerpc/include/asm/book3s/64/mmu-hash.h
+++ b/arch/powerpc/include/asm/book3s/64/mmu-hash.h
@@ -682,6 +682,9 @@ static inline unsigned long get_kernel_vsid(unsigned long ea, int ssize)
{
unsigned long context;
+ if (!is_kernel_addr(ea))
+ return 0;
+
/*
* For kernel space, we use context ids 1-4 to map the address space as
* below: