arch/arm/mm/kasan_init.c:229:9: warning: incompatible integer to pointer conversion passing 'unsigned long' to parameter of type 'const void *'

From: kernel test robot
Date: Tue Jul 13 2021 - 06:45:52 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 7fef2edf7cc753b51f7ccc74993971b0a9c81eca
commit: dc4875f0e791de554bdc45aa1dbd6e45e107e50f mm: rename p4d_page_vaddr to p4d_pgtable and make it return pud_t *
date: 5 days ago
config: arm-buildonly-randconfig-r002-20210713 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 8d69635ed9ecf36fd0ca85906bfde17949671cbe)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install arm cross compiling tool for clang build
# apt-get install binutils-arm-linux-gnueabi
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=dc4875f0e791de554bdc45aa1dbd6e45e107e50f
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout dc4875f0e791de554bdc45aa1dbd6e45e107e50f
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

>> arch/arm/mm/kasan_init.c:229:9: warning: incompatible integer to pointer conversion passing 'unsigned long' to parameter of type 'const void *' [-Wint-conversion]
pgd_page_vaddr(*pgd_offset_k(KASAN_SHADOW_START)),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/asm-generic/pgtable-nop4d.h:44:31: note: expanded from macro 'pgd_page_vaddr'
#define pgd_page_vaddr(pgd) ((unsigned long)(p4d_pgtable((p4d_t){ pgd })))
^
arch/arm/include/asm/string.h:58:45: note: expanded from macro 'memcpy'
#define memcpy(dst, src, len) __memcpy(dst, src, len)
^~~
arch/arm/include/asm/string.h:21:47: note: passing argument to parameter 'src' here
extern void *__memcpy(void *dest, const void *src, __kernel_size_t n);
^
1 warning generated.


vim +229 arch/arm/mm/kasan_init.c

5615f69bc20974 Linus Walleij 2020-10-25 204
5615f69bc20974 Linus Walleij 2020-10-25 205 void __init kasan_init(void)
5615f69bc20974 Linus Walleij 2020-10-25 206 {
5615f69bc20974 Linus Walleij 2020-10-25 207 phys_addr_t pa_start, pa_end;
5615f69bc20974 Linus Walleij 2020-10-25 208 u64 i;
5615f69bc20974 Linus Walleij 2020-10-25 209
5615f69bc20974 Linus Walleij 2020-10-25 210 /*
5615f69bc20974 Linus Walleij 2020-10-25 211 * We are going to perform proper setup of shadow memory.
5615f69bc20974 Linus Walleij 2020-10-25 212 *
5615f69bc20974 Linus Walleij 2020-10-25 213 * At first we should unmap early shadow (clear_pgds() call bellow).
5615f69bc20974 Linus Walleij 2020-10-25 214 * However, instrumented code can't execute without shadow memory.
5615f69bc20974 Linus Walleij 2020-10-25 215 *
5615f69bc20974 Linus Walleij 2020-10-25 216 * To keep the early shadow memory MMU tables around while setting up
5615f69bc20974 Linus Walleij 2020-10-25 217 * the proper shadow memory, we copy swapper_pg_dir (the initial page
5615f69bc20974 Linus Walleij 2020-10-25 218 * table) to tmp_pgd_table and use that to keep the early shadow memory
5615f69bc20974 Linus Walleij 2020-10-25 219 * mapped until the full shadow setup is finished. Then we swap back
5615f69bc20974 Linus Walleij 2020-10-25 220 * to the proper swapper_pg_dir.
5615f69bc20974 Linus Walleij 2020-10-25 221 */
5615f69bc20974 Linus Walleij 2020-10-25 222
5615f69bc20974 Linus Walleij 2020-10-25 223 memcpy(tmp_pgd_table, swapper_pg_dir, sizeof(tmp_pgd_table));
5615f69bc20974 Linus Walleij 2020-10-25 224 #ifdef CONFIG_ARM_LPAE
5615f69bc20974 Linus Walleij 2020-10-25 225 /* We need to be in the same PGD or this won't work */
5615f69bc20974 Linus Walleij 2020-10-25 226 BUILD_BUG_ON(pgd_index(KASAN_SHADOW_START) !=
5615f69bc20974 Linus Walleij 2020-10-25 227 pgd_index(KASAN_SHADOW_END));
5615f69bc20974 Linus Walleij 2020-10-25 228 memcpy(tmp_pmd_table,
5615f69bc20974 Linus Walleij 2020-10-25 @229 pgd_page_vaddr(*pgd_offset_k(KASAN_SHADOW_START)),

:::::: The code at line 229 was first introduced by commit
:::::: 5615f69bc2097452ecc954f5264d784e158d6801 ARM: 9016/2: Initialize the mapping of KASan shadow memory

:::::: TO: Linus Walleij <linus.walleij@xxxxxxxxxx>
:::::: CC: Russell King <rmk+kernel@xxxxxxxxxxxxxxx>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip