mm: check virt_to_xxxx macro on 32bit OS [1/1]

PD#SWPL-1909

Problem:
virt_to_page may get bad input with virtual address
in high mem.

Solution:
Check input address of this macro and get a warn print

Verify:
p212

Change-Id: I69d81f7aac43f1865d3d1112263276603de166ce
Signed-off-by: Tao Zeng <tao.zeng@amlogic.com>
This commit is contained in:
Tao Zeng
2018-12-25 19:17:25 +08:00
committed by Dongjin Kim
parent 37fb5606f0
commit cad9987c69

View File

@@ -263,9 +263,16 @@ static inline unsigned long __phys_to_virt(phys_addr_t x)
#endif
#ifdef CONFIG_AMLOGIC_MODIFY
#define virt_to_pfn(kaddr) \
({virt_check((unsigned long)kaddr); \
((((unsigned long)(kaddr) - PAGE_OFFSET) >> PAGE_SHIFT) + \
PHYS_PFN_OFFSET); })
#else
#define virt_to_pfn(kaddr) \
((((unsigned long)(kaddr) - PAGE_OFFSET) >> PAGE_SHIFT) + \
PHYS_PFN_OFFSET)
#endif
/*
* These are *only* valid on the kernel direct mapped RAM memory.