提交 85beb1c4 编写于 作者: M Michael Ellerman

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: NMichael Ellerman <mpe@ellerman.id.au>
上级 941711a3
...@@ -682,6 +682,9 @@ static inline unsigned long get_kernel_vsid(unsigned long ea, int ssize) ...@@ -682,6 +682,9 @@ static inline unsigned long get_kernel_vsid(unsigned long ea, int ssize)
{ {
unsigned long context; 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 * For kernel space, we use context ids 1-4 to map the address space as
* below: * below:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册