On Tue, Jun 11, 2019 at 01:41:21AM +0200, Hauke Mehrtens wrote:
On 5/28/19 7:05 PM, Paul Burton wrote:
arch/mips/mm/mmap.c | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/arch/mips/mm/mmap.c b/arch/mips/mm/mmap.c index 2f616ebeb7e0..7755a1fad05a 100644 --- a/arch/mips/mm/mmap.c +++ b/arch/mips/mm/mmap.c @@ -203,6 +203,11 @@ unsigned long arch_randomize_brk(struct mm_struct *mm) int __virt_addr_valid(const volatile void *kaddr) {
- unsigned long vaddr = (unsigned long)vaddr;
the second vaddr should be better kaddr
- if ((vaddr < PAGE_OFFSET) || (vaddr >= MAP_BASE))
return 0;
- return pfn_valid(PFN_DOWN(virt_to_phys(kaddr)));
} EXPORT_SYMBOL_GPL(__virt_addr_valid);
Someone complained that this compiled to a constant "return 0" for him: https://bugs.openwrt.org/index.php?do=details&task_id=2305#comment6554
I just checked this on a unmodified 5.2-rc4 with the xway_defconfig and I get this:
0001915c <__virt_addr_valid>: 1915c: 03e00008 jr ra 19160: 00001025 move v0,zero
Is this intended?
I don't think so. Interesting what the compiler decides to do here.
Thomas.