arch/loongarch/kernel/relocate.c:166:38: sparse: sparse: incorrect type in initializer (different address spaces)

From: kernel test robot
Date: Thu Nov 30 2023 - 12:54:32 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 3b47bc037bd44f142ac09848e8d3ecccc726be99
commit: e5f02b51fa0cb785e352e77271a65e96051b789b LoongArch: Add support for kernel address space layout randomization (KASLR)
date: 9 months ago
config: loongarch-randconfig-r034-20230511 (https://download.01.org/0day-ci/archive/20231201/202312010123.vwEMnB5J-lkp@xxxxxxxxx/config)
compiler: loongarch64-linux-gcc (GCC) 12.3.0
reproduce: (https://download.01.org/0day-ci/archive/20231201/202312010123.vwEMnB5J-lkp@xxxxxxxxx/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202312010123.vwEMnB5J-lkp@xxxxxxxxx/

sparse warnings: (new ones prefixed by >>)
>> arch/loongarch/kernel/relocate.c:166:38: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected char *cmdline @@ got void [noderef] __iomem * @@
arch/loongarch/kernel/relocate.c:166:38: sparse: expected char *cmdline
arch/loongarch/kernel/relocate.c:166:38: sparse: got void [noderef] __iomem *

vim +166 arch/loongarch/kernel/relocate.c

159
160 void * __init relocate_kernel(void)
161 {
162 unsigned long kernel_length;
163 unsigned long random_offset = 0;
164 void *location_new = _text; /* Default to original kernel start */
165 void *kernel_entry = start_kernel; /* Default to original kernel entry point */
> 166 char *cmdline = early_ioremap(fw_arg1, COMMAND_LINE_SIZE); /* Boot command line is passed in fw_arg1 */
167
168 strscpy(boot_command_line, cmdline, COMMAND_LINE_SIZE);
169

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki