提交 77611efc 编写于 作者: X Xiongfeng Wang 提交者: Yang Yingliang

arm64: ilp32: fix compile warning cause by 'VA_BITS'

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: NXiongfeng Wang <wangxiongfeng2@huawei.com>
Reviewed-by: NHanjun Guo &lt;guohanjun@huawei.com <mailto:guohanjun@huawei.com&gt;>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 e80ab999
......@@ -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.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册