From: kernel test robot <lkp@intel.com>
To: Youling Tang <tangyouling@kylinos.cn>
Cc: oe-kbuild-all@lists.linux.dev, linux-kernel@vger.kernel.org,
Huacai Chen <chenhuacai@kernel.org>
Subject: arch/loongarch/kernel/kexec_efi.c:64:22: sparse: sparse: cast to restricted __le64
Date: Sun, 14 Dec 2025 14:30:07 +0800 [thread overview]
Message-ID: <202512141450.vbW57SvC-lkp@intel.com> (raw)
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@intel.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
next reply other threads:[~2025-12-14 6:30 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-14 6:30 kernel test robot [this message]
-- strict thread matches above, loose matches on Subject: below --
2026-01-18 5:11 arch/loongarch/kernel/kexec_efi.c:64:22: sparse: sparse: cast to restricted __le64 kernel test robot
2026-05-05 9:58 kernel test robot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202512141450.vbW57SvC-lkp@intel.com \
--to=lkp@intel.com \
--cc=chenhuacai@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=tangyouling@kylinos.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox