Skip to content

Commit

Permalink
s390/vmem: Fix null-pointer-arithmetic warning in vmem_map_init()
Browse files Browse the repository at this point in the history
Fixes the following clang warning introduced by commit d7bebcb
("s390: Optimize __pa/__va when RANDOMIZE_IDENTITY_BASE is off")

arch/s390/mm/vmem.c:665:36: warning: performing pointer arithmetic on
a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
  665 |                 __set_memory_4k(__va(0), __va(0) + ident_map_size);
      |                                          ~~~~~~~ ^

Fixes: d7bebcb ("s390: Optimize __pa/__va when RANDOMIZE_IDENTITY_BASE is off")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202501270309.HzsVNo3o-lkp@intel.com/
Reviewed-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
  • Loading branch information
Vasily Gorbik authored and Alexander Gordeev committed Jan 28, 2025
1 parent 3b8b80e commit b05d66c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion arch/s390/mm/vmem.c
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,7 @@ void __init vmem_map_init(void)
if (!static_key_enabled(&cpu_has_bear))
set_memory_x(0, 1);
if (debug_pagealloc_enabled())
__set_memory_4k(__va(0), __va(0) + ident_map_size);
__set_memory_4k(__va(0), absolute_pointer(__va(0)) + ident_map_size);
pr_info("Write protected kernel read-only data: %luk\n",
(unsigned long)(__end_rodata - _stext) >> 10);
}

0 comments on commit b05d66c

Please sign in to comment.