Messages in this thread |  | | Date | Tue, 05 May 2026 16:12:46 +0800 | | From | kernel test robot <> | | Subject | arch/loongarch/kernel/machine_kexec.c:84:51: sparse: sparse: incorrect type in argument 2 (different address spaces) |
| |
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: a293ec25d59dd96309058c70df5a4dd0f889a1e4 commit: d162feec6b6e7ed97986118450812fdd7e9ba202 LoongArch: Add preparatory infrastructure for kexec_file date: 7 months ago config: loongarch-randconfig-r122-20260505 (https://download.01.org/0day-ci/archive/20260505/202605051639.aEPioXdD-lkp@intel.com/config) compiler: loongarch64-linux-gcc (GCC) 14.3.0 sparse: v0.6.5-rc1 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260505/202605051639.aEPioXdD-lkp@intel.com/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 | Fixes: d162feec6b6e ("LoongArch: Add preparatory infrastructure for kexec_file") | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202605051639.aEPioXdD-lkp@intel.com/
sparse warnings: (new ones prefixed by >>) >> arch/loongarch/kernel/machine_kexec.c:84:51: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected char const * @@ got char [noderef] __user * @@ arch/loongarch/kernel/machine_kexec.c:84:51: sparse: expected char const * arch/loongarch/kernel/machine_kexec.c:84:51: sparse: got char [noderef] __user *
vim +84 arch/loongarch/kernel/machine_kexec.c
4a03b2ac06a5bca Youling Tang 2022-10-12 61 4a03b2ac06a5bca Youling Tang 2022-10-12 62 int machine_kexec_prepare(struct kimage *kimage) 4a03b2ac06a5bca Youling Tang 2022-10-12 63 { 4a03b2ac06a5bca Youling Tang 2022-10-12 64 int i; 4a03b2ac06a5bca Youling Tang 2022-10-12 65 char *bootloader = "kexec"; 4a03b2ac06a5bca Youling Tang 2022-10-12 66 void *cmdline_ptr = (void *)KEXEC_CMDLINE_ADDR; 4a03b2ac06a5bca Youling Tang 2022-10-12 67 4a03b2ac06a5bca Youling Tang 2022-10-12 68 kexec_image_info(kimage); 4a03b2ac06a5bca Youling Tang 2022-10-12 69 4a03b2ac06a5bca Youling Tang 2022-10-12 70 kimage->arch.efi_boot = fw_arg0; 4a03b2ac06a5bca Youling Tang 2022-10-12 71 kimage->arch.systable_ptr = fw_arg2; 4a03b2ac06a5bca Youling Tang 2022-10-12 72 d162feec6b6e7ed Youling Tang 2025-10-02 73 if (kimage->file_mode == 1) { d162feec6b6e7ed Youling Tang 2025-10-02 74 /* d162feec6b6e7ed Youling Tang 2025-10-02 75 * kimage->cmdline_buf will be released in kexec_file_load, so copy d162feec6b6e7ed Youling Tang 2025-10-02 76 * to the KEXEC_CMDLINE_ADDR safe area. d162feec6b6e7ed Youling Tang 2025-10-02 77 */ d162feec6b6e7ed Youling Tang 2025-10-02 78 memcpy((void *)KEXEC_CMDLINE_ADDR, (void *)kimage->arch.cmdline_ptr, d162feec6b6e7ed Youling Tang 2025-10-02 79 strlen((char *)kimage->arch.cmdline_ptr) + 1); d162feec6b6e7ed Youling Tang 2025-10-02 80 kimage->arch.cmdline_ptr = (unsigned long)KEXEC_CMDLINE_ADDR; d162feec6b6e7ed Youling Tang 2025-10-02 81 } else { 4a03b2ac06a5bca Youling Tang 2022-10-12 82 /* Find the command line */ 4a03b2ac06a5bca Youling Tang 2022-10-12 83 for (i = 0; i < kimage->nr_segments; i++) { 4a03b2ac06a5bca Youling Tang 2022-10-12 @84 if (!strncmp(bootloader, (char __user *)kimage->segment[i].buf, strlen(bootloader))) { 4a03b2ac06a5bca Youling Tang 2022-10-12 85 if (!copy_from_user(cmdline_ptr, kimage->segment[i].buf, COMMAND_LINE_SIZE)) 4a03b2ac06a5bca Youling Tang 2022-10-12 86 kimage->arch.cmdline_ptr = (unsigned long)cmdline_ptr; 4a03b2ac06a5bca Youling Tang 2022-10-12 87 break; 4a03b2ac06a5bca Youling Tang 2022-10-12 88 } 4a03b2ac06a5bca Youling Tang 2022-10-12 89 } 4a03b2ac06a5bca Youling Tang 2022-10-12 90 4a03b2ac06a5bca Youling Tang 2022-10-12 91 if (!kimage->arch.cmdline_ptr) { 4a03b2ac06a5bca Youling Tang 2022-10-12 92 pr_err("Command line not included in the provided image\n"); 4a03b2ac06a5bca Youling Tang 2022-10-12 93 return -EINVAL; 4a03b2ac06a5bca Youling Tang 2022-10-12 94 } d162feec6b6e7ed Youling Tang 2025-10-02 95 } 4a03b2ac06a5bca Youling Tang 2022-10-12 96 4e62d1d86585e1b Youling Tang 2022-10-12 97 /* kexec/kdump need a safe page to save reboot_code_buffer */ 4a03b2ac06a5bca Youling Tang 2022-10-12 98 kimage->control_code_page = virt_to_page((void *)KEXEC_CONTROL_CODE); 4a03b2ac06a5bca Youling Tang 2022-10-12 99 4a03b2ac06a5bca Youling Tang 2022-10-12 100 reboot_code_buffer = (unsigned long)page_address(kimage->control_code_page); 4a03b2ac06a5bca Youling Tang 2022-10-12 101 memcpy((void *)reboot_code_buffer, relocate_new_kernel, relocate_new_kernel_size); 4a03b2ac06a5bca Youling Tang 2022-10-12 102
:::::: The code at line 84 was first introduced by commit :::::: 4a03b2ac06a5bcae29371866d9d11f5bfd4c9188 LoongArch: Add kexec support
:::::: TO: Youling Tang <tangyouling@loongson.cn> :::::: CC: Huacai Chen <chenhuacai@loongson.cn>
-- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
|  |