[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202512141450.vbW57SvC-lkp@intel.com>
Date: Sun, 14 Dec 2025 14:30:07 +0800
From: kernel test robot <lkp@...el.com>
To: Youling Tang <tangyouling@...inos.cn>
Cc: oe-kbuild-all@...ts.linux.dev, linux-kernel@...r.kernel.org,
Huacai Chen <chenhuacai@...nel.org>
Subject: arch/loongarch/kernel/kexec_efi.c:64:22: sparse: sparse: cast to
restricted __le64
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 8f0b4cce4481fb22653697cced8d0d04027cb1e8
commit: 55d990f0084c2b8ab9321dc59fc11dce855b4d61 LoongArch: Add EFI binary support for kexec_file
date: 2 months ago
config: loongarch-randconfig-r134-20251214 (https://download.01.org/0day-ci/archive/20251214/202512141450.vbW57SvC-lkp@intel.com/config)
compiler: loongarch64-linux-gcc (GCC) 15.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251214/202512141450.vbW57SvC-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
| Reported-by: kernel test robot <lkp@...el.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202512141450.vbW57SvC-lkp@intel.com/
sparse warnings: (new ones prefixed by >>)
>> arch/loongarch/kernel/kexec_efi.c:64:22: sparse: sparse: cast to restricted __le64
arch/loongarch/kernel/kexec_efi.c:65:23: sparse: sparse: cast to restricted __le64
vim +64 arch/loongarch/kernel/kexec_efi.c
37
38 static void *efi_kexec_load(struct kimage *image,
39 char *kernel, unsigned long kernel_len,
40 char *initrd, unsigned long initrd_len,
41 char *cmdline, unsigned long cmdline_len)
42 {
43 int ret;
44 unsigned long text_offset, kernel_segment_number;
45 struct kexec_buf kbuf;
46 struct kexec_segment *kernel_segment;
47 struct loongarch_image_header *h;
48
49 h = (struct loongarch_image_header *)kernel;
50 if (!h->kernel_asize)
51 return ERR_PTR(-EINVAL);
52
53 /*
54 * Load the kernel
55 * FIXME: Non-relocatable kernel rejected for kexec_file (require CONFIG_RELOCATABLE)
56 */
57 kbuf.image = image;
58 kbuf.buf_max = ULONG_MAX;
59 kbuf.top_down = false;
60
61 kbuf.buffer = kernel;
62 kbuf.bufsz = kernel_len;
63 kbuf.mem = KEXEC_BUF_MEM_UNKNOWN;
> 64 kbuf.memsz = le64_to_cpu(h->kernel_asize);
65 text_offset = le64_to_cpu(h->text_offset);
66 kbuf.buf_min = text_offset;
67 kbuf.buf_align = SZ_2M;
68
69 kernel_segment_number = image->nr_segments;
70
71 /*
72 * The location of the kernel segment may make it impossible to
73 * satisfy the other segment requirements, so we try repeatedly
74 * to find a location that will work.
75 */
76 while ((ret = kexec_add_buffer(&kbuf)) == 0) {
77 /* Try to load additional data */
78 kernel_segment = &image->segment[kernel_segment_number];
79 ret = load_other_segments(image, kernel_segment->mem,
80 kernel_segment->memsz, initrd,
81 initrd_len, cmdline, cmdline_len);
82 if (!ret)
83 break;
84
85 /*
86 * We couldn't find space for the other segments; erase the
87 * kernel segment and try the next available hole.
88 */
89 image->nr_segments -= 1;
90 kbuf.buf_min = kernel_segment->mem + kernel_segment->memsz;
91 kbuf.mem = KEXEC_BUF_MEM_UNKNOWN;
92 }
93
94 if (ret < 0) {
95 pr_err("Could not find any suitable kernel location!");
96 return ERR_PTR(ret);
97 }
98
99 kernel_segment = &image->segment[kernel_segment_number];
100
101 /* Make sure the second kernel jumps to the correct "kernel_entry" */
102 image->start = kernel_segment->mem + h->kernel_entry - text_offset;
103
104 kexec_dprintk("Loaded kernel at 0x%lx bufsz=0x%lx memsz=0x%lx\n",
105 kernel_segment->mem, kbuf.bufsz, kernel_segment->memsz);
106
107 return NULL;
108 }
109
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Powered by blists - more mailing lists