[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202210180653.0CHpRaQv-lkp@intel.com>
Date: Tue, 18 Oct 2022 06:24:43 +0800
From: kernel test robot <lkp@...el.com>
To: Youling Tang <tangyouling@...ngson.cn>
Cc: kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org,
Huacai Chen <chenhuacai@...nel.org>
Subject: arch/loongarch/kernel/machine_kexec.c:69:43: 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: bbb8ceb5e2421184db9560e9d2cfaf858e1db616
commit: 4a03b2ac06a5bcae29371866d9d11f5bfd4c9188 LoongArch: Add kexec support
date: 6 days ago
config: loongarch-randconfig-s031-20221017
compiler: loongarch64-linux-gcc (GCC) 12.1.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.4-39-gce1a6720-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=4a03b2ac06a5bcae29371866d9d11f5bfd4c9188
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 4a03b2ac06a5bcae29371866d9d11f5bfd4c9188
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=loongarch SHELL=/bin/bash
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@...el.com>
sparse warnings: (new ones prefixed by >>)
>> arch/loongarch/kernel/machine_kexec.c:69:43: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected char const * @@ got char [noderef] __user * @@
arch/loongarch/kernel/machine_kexec.c:69:43: sparse: expected char const *
arch/loongarch/kernel/machine_kexec.c:69:43: sparse: got char [noderef] __user *
vim +69 arch/loongarch/kernel/machine_kexec.c
55
56 int machine_kexec_prepare(struct kimage *kimage)
57 {
58 int i;
59 char *bootloader = "kexec";
60 void *cmdline_ptr = (void *)KEXEC_CMDLINE_ADDR;
61
62 kexec_image_info(kimage);
63
64 kimage->arch.efi_boot = fw_arg0;
65 kimage->arch.systable_ptr = fw_arg2;
66
67 /* Find the command line */
68 for (i = 0; i < kimage->nr_segments; i++) {
> 69 if (!strncmp(bootloader, (char __user *)kimage->segment[i].buf, strlen(bootloader))) {
70 if (!copy_from_user(cmdline_ptr, kimage->segment[i].buf, COMMAND_LINE_SIZE))
71 kimage->arch.cmdline_ptr = (unsigned long)cmdline_ptr;
72 break;
73 }
74 }
75
76 if (!kimage->arch.cmdline_ptr) {
77 pr_err("Command line not included in the provided image\n");
78 return -EINVAL;
79 }
80
81 /* kexec need a safe page to save reboot_code_buffer */
82 kimage->control_code_page = virt_to_page((void *)KEXEC_CONTROL_CODE);
83
84 reboot_code_buffer = (unsigned long)page_address(kimage->control_code_page);
85 memcpy((void *)reboot_code_buffer, relocate_new_kernel, relocate_new_kernel_size);
86
--
0-DAY CI Kernel Test Service
https://01.org/lkp
View attachment "config" of type "text/plain" (149912 bytes)
Powered by blists - more mailing lists