From: Xiongfeng Wang wangxiongfeng2@huawei.com
hulk inclusion category: feature bugzilla: NA CVE: NA ---------------------------
Compiling with 'CONFIG_ARM64_ILP32' enabled display the following warning.
./arch/arm64/include/asm/memory.h: In function ‘kaslr_offset’: ./arch/arm64/include/asm/memory.h:61:9: warning: left shift count >= width of type [-Wshift-count-overflow] (UL(1) << VA_BITS) + 1) ^ ./arch/arm64/include/asm/memory.h:66:25: note: in expansion of macro ‘VA_START’ #define MODULES_VADDR (VA_START + KASAN_SHADOW_SIZE) ^~~~~~~~ ./arch/arm64/include/asm/memory.h: In function ‘virt_to_phys’: ./include/linux/bits.h:6:24: warning: left shift count >= width of type [-Wshift-count-overflow] #define BIT(nr) (1UL << (nr)) ^ ./arch/arm64/include/asm/memory.h:228:44: note: in expansion of macro ‘BIT’ #define __is_lm_address(addr) (!!((addr) & BIT(VA_BITS - 1))) ^~~
./arch/arm64/include/asm/memory.h: In function ‘phys_to_virt’: ./arch/arm64/include/asm/memory.h:63:9: warning: left shift count >= width of type [-Wshift-count-overflow] (UL(1) << (VA_BITS - 1)) + 1) ^ ./arch/arm64/include/asm/memory.h:249:65: note: in expansion of macro ‘PAGE_OFFSET’ #define __phys_to_virt(x) ((unsigned long)((x) - PHYS_OFFSET) | PAGE_OFFSET) ^~~~~~~~~~~
Fix it by excluding these three function when __ILP32__ is not defined since they are not used in 'gettimeofday.c'.
Signed-off-by: Xiongfeng Wang wangxiongfeng2@huawei.com Reviewed-by: Hanjun Guo <guohanjun@huawei.com mailto:guohanjun@huawei.com> Signed-off-by: Yang Yingliang yangyingliang@huawei.com --- arch/arm64/include/asm/memory.h | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/arch/arm64/include/asm/memory.h b/arch/arm64/include/asm/memory.h index 09bba86224b07..fc13895cfc79b 100644 --- a/arch/arm64/include/asm/memory.h +++ b/arch/arm64/include/asm/memory.h @@ -192,10 +192,12 @@ extern u64 kimage_vaddr; /* the offset between the kernel virtual and physical mappings */ extern u64 kimage_voffset;
+#ifndef __ILP32__ static inline unsigned long kaslr_offset(void) { return kimage_vaddr - KIMAGE_VADDR; } +#endif
/* * Allow all memory at the discovery stage. We will clip it later. @@ -255,6 +257,7 @@ extern phys_addr_t __phys_addr_symbol(unsigned long x); #define page_to_phys(page) (__pfn_to_phys(page_to_pfn(page))) #define phys_to_page(phys) (pfn_to_page(__phys_to_pfn(phys)))
+#ifndef __ILP32__ /* * Note: Drivers should NOT use these. They are the wrong * translation for translating DMA addresses. Use the driver @@ -271,6 +274,7 @@ static inline void *phys_to_virt(phys_addr_t x) { return (void *)(__phys_to_virt(x)); } +#endif
/* * Drivers should NOT use these either.