[linux-next:master 13132/13536] arch/loongarch/kernel/relocate.c:212:24: sparse: sparse: incorrect type in argument 1 (different address spaces)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   dee7f101b64219f512bb2f842227bd04c14efe30
commit: 2d974d2671121272dbe8142e11c6a5ec28123d21 [13132/13536] LoongArch: Use correct API to map cmdline in relocate_kernel()
config: loongarch-randconfig-r122-20240722 (https://download.01.org/0day-ci/archive/20240723/202407231154.QJTaxbpZ-lkp@xxxxxxxxx/config)
compiler: loongarch64-linux-gcc (GCC) 14.1.0
reproduce: (https://download.01.org/0day-ci/archive/20240723/202407231154.QJTaxbpZ-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/202407231154.QJTaxbpZ-lkp@xxxxxxxxx/

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

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

   194	
   195	unsigned long __init relocate_kernel(void)
   196	{
   197		unsigned long kernel_length;
   198		unsigned long random_offset = 0;
   199		void *location_new = _text; /* Default to original kernel start */
   200		char *cmdline = early_memremap_ro(fw_arg1, COMMAND_LINE_SIZE); /* Boot command line is passed in fw_arg1 */
   201	
   202		strscpy(boot_command_line, cmdline, COMMAND_LINE_SIZE);
   203	
   204	#ifdef CONFIG_RANDOMIZE_BASE
   205		location_new = determine_relocation_address();
   206	
   207		/* Sanity check relocation address */
   208		if (relocation_addr_valid(location_new))
   209			random_offset = (unsigned long)location_new - (unsigned long)(_text);
   210	#endif
   211		reloc_offset = (unsigned long)_text - VMLINUX_LOAD_ADDRESS;
 > 212		early_memunmap(cmdline, COMMAND_LINE_SIZE);
   213	
   214		if (random_offset) {
   215			kernel_length = (long)(_end) - (long)(_text);
   216	
   217			/* Copy the kernel to it's new location */
   218			memcpy(location_new, _text, kernel_length);
   219	
   220			/* Sync the caches ready for execution of new kernel */
   221			__asm__ __volatile__ (
   222				"ibar 0 \t\n"
   223				"dbar 0 \t\n"
   224				::: "memory");
   225	
   226			reloc_offset += random_offset;
   227	
   228			/* The current thread is now within the relocated kernel */
   229			__current_thread_info = RELOCATED_KASLR(__current_thread_info);
   230	
   231			update_reloc_offset(&reloc_offset, random_offset);
   232		}
   233	
   234		if (reloc_offset)
   235			relocate_relative();
   236	
   237		relocate_absolute(random_offset);
   238	
   239		return random_offset;
   240	}
   241	

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




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux