Message ID | 20220406145802.538416-1-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:57 +1000, Michael Ellerman wrote: > From: Kefeng Wang <wangkefeng.wang@huawei.com> > > mpe: On 64-bit Book3E vmalloc space starts at 0x8000000000000000. > > Because of the way __pa() works we have: > __pa(0x8000000000000000) == 0, and therefore > virt_to_pfn(0x8000000000000000) == 0, and therefore > virt_addr_valid(0x8000000000000000) == true > > [...] Patches 1 & 2 applied to powerpc/fixes. [1/6] powerpc: Fix virt_addr_valid() for 64-bit Book3E & 32-bit https://git.kernel.org/powerpc/c/ffa0b64e3be58519ae472ea29a1a1ad681e32f48 [2/6] Revert "powerpc: Set max_mapnr correctly" https://git.kernel.org/powerpc/c/1ff5c8e8c835e8a81c0868e3050c76563dd56a2c cheers
diff --git a/arch/powerpc/include/asm/page.h b/arch/powerpc/include/asm/page.h index 254687258f42..f2c5c26869f1 100644 --- a/arch/powerpc/include/asm/page.h +++ b/arch/powerpc/include/asm/page.h @@ -132,7 +132,11 @@ static inline bool pfn_valid(unsigned long pfn) #define virt_to_page(kaddr) pfn_to_page(virt_to_pfn(kaddr)) #define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT) -#define virt_addr_valid(kaddr) pfn_valid(virt_to_pfn(kaddr)) +#define virt_addr_valid(vaddr) ({ \ + unsigned long _addr = (unsigned long)vaddr; \ + _addr >= PAGE_OFFSET && _addr < (unsigned long)high_memory && \ + pfn_valid(virt_to_pfn(_addr)); \ +}) /* * On Book-E parts we need __va to parse the device tree and we can't