summaryrefslogtreecommitdiffstats
path: root/arch/s390/mm/vmem.c
diff options
context:
space:
mode:
authorHeiko Carstens <heiko.carstens@de.ibm.com>2017-11-08 11:18:29 +0100
committerHeiko Carstens <heiko.carstens@de.ibm.com>2017-11-08 22:11:20 +0100
commitead7a22e9b6eff225afb127f8835a1d3da271a89 (patch)
tree296023c7e837c5cfecc4f0ee935232161e9472ae /arch/s390/mm/vmem.c
parents390/disassembler: generate opcode tables from text file (diff)
downloadlinux-ead7a22e9b6eff225afb127f8835a1d3da271a89.tar.xz
linux-ead7a22e9b6eff225afb127f8835a1d3da271a89.zip
s390: avoid undefined behaviour
At a couple of places smatch emits warnings like this: arch/s390/mm/vmem.c:409 vmem_map_init() warn: right shifting more than type allows In fact shifting a signed type right is undefined. Avoid this and add an unsigned long cast. The shifted values are always positive. Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Diffstat (limited to 'arch/s390/mm/vmem.c')
-rw-r--r--arch/s390/mm/vmem.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/arch/s390/mm/vmem.c b/arch/s390/mm/vmem.c
index f890f2ad951b..24671beb2def 100644
--- a/arch/s390/mm/vmem.c
+++ b/arch/s390/mm/vmem.c
@@ -402,17 +402,17 @@ void __init vmem_map_init(void)
for_each_memblock(memory, reg)
vmem_add_mem(reg->base, reg->size);
- __set_memory((unsigned long) _stext,
- (_etext - _stext) >> PAGE_SHIFT,
+ __set_memory((unsigned long)_stext,
+ (unsigned long)(_etext - _stext) >> PAGE_SHIFT,
SET_MEMORY_RO | SET_MEMORY_X);
- __set_memory((unsigned long) _etext,
- (__end_rodata - _etext) >> PAGE_SHIFT,
+ __set_memory((unsigned long)_etext,
+ (unsigned long)(__end_rodata - _etext) >> PAGE_SHIFT,
SET_MEMORY_RO);
- __set_memory((unsigned long) _sinittext,
- (_einittext - _sinittext) >> PAGE_SHIFT,
+ __set_memory((unsigned long)_sinittext,
+ (unsigned long)(_einittext - _sinittext) >> PAGE_SHIFT,
SET_MEMORY_RO | SET_MEMORY_X);
pr_info("Write protected kernel read-only data: %luk\n",
- (__end_rodata - _stext) >> 10);
+ (unsigned long)(__end_rodata - _stext) >> 10);
}
/*