Message ID | 20220406145802.538416-3-mpe@ellerman.id.au (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
Series | [1/6] powerpc: Fix virt_addr_valid() for 64-bit Book3E & 32-bit | expand |
On Thu, 7 Apr 2022 00:57:59 +1000, Michael Ellerman wrote: > In smp_85xx_start_cpu() we are passed an address but we're unsure if > it's a real or virtual address, so there's a check to determine that. > > [...] Applied to powerpc/next. [3/6] powerpc/85xx: Fix virt_to_phys() off-by-one in smp_85xx_start_cpu() https://git.kernel.org/powerpc/c/0d897255e79e26f471d10bbf72db9eee6f9cb723 cheers
diff --git a/arch/powerpc/platforms/85xx/smp.c b/arch/powerpc/platforms/85xx/smp.c index a1c6a7827c8f..9c43cf32f4c9 100644 --- a/arch/powerpc/platforms/85xx/smp.c +++ b/arch/powerpc/platforms/85xx/smp.c @@ -208,7 +208,7 @@ static int smp_85xx_start_cpu(int cpu) * The bootpage and highmem can be accessed via ioremap(), but * we need to directly access the spinloop if its in lowmem. */ - ioremappable = *cpu_rel_addr > virt_to_phys(high_memory); + ioremappable = *cpu_rel_addr > virt_to_phys(high_memory - 1); /* Map the spin table */ if (ioremappable)
In smp_85xx_start_cpu() we are passed an address but we're unsure if it's a real or virtual address, so there's a check to determine that. The check has an off-by-one in that it tests if the address is greater than high_memory, but high_memory is the first address of high memory, so the check should be greater-or-equal. It seems this has never been a problem in practice, but it also triggers the DEBUG_VIRTUAL checks in __pa() which we would like to avoid. We can fix both issues by converting high_memory - 1 to a physical address and testing against that. Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> --- arch/powerpc/platforms/85xx/smp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)