[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202512160142.4NPjO76q-lkp@intel.com>
Date: Tue, 16 Dec 2025 01:37:25 +0800
From: kernel test robot <lkp@...el.com>
To: Song Shuai <songshuaishuai@...ylab.org>
Cc: oe-kbuild-all@...ts.linux.dev, linux-kernel@...r.kernel.org,
Palmer Dabbelt <palmer@...belt.com>,
Björn Töpel <bjorn@...osinc.com>,
Alexandre Ghiti <alexghiti@...osinc.com>
Subject: arch/riscv/kernel/kexec_image.c:55:17: sparse: sparse: cast to
restricted __le64
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 8f0b4cce4481fb22653697cced8d0d04027cb1e8
commit: 809a11eea8e8c80491e3ba3a286af25409c072d5 riscv: kexec_file: Support loading Image binary file
date: 6 months ago
config: riscv-randconfig-r111-20251215 (https://download.01.org/0day-ci/archive/20251216/202512160142.4NPjO76q-lkp@intel.com/config)
compiler: clang version 22.0.0git (https://github.com/llvm/llvm-project 1335a05ab8bc8339ce24be3a9da89d8c3f4e0571)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251216/202512160142.4NPjO76q-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/202512160142.4NPjO76q-lkp@intel.com/
sparse warnings: (new ones prefixed by >>)
WARNING: invalid argument to '-march': '_zacas_zabha'
>> arch/riscv/kernel/kexec_image.c:55:17: sparse: sparse: cast to restricted __le64
arch/riscv/kernel/kexec_image.c:72:22: sparse: sparse: cast to restricted __le64
arch/riscv/kernel/kexec_image.c:73:26: sparse: sparse: cast to restricted __le64
vim +55 arch/riscv/kernel/kexec_image.c
35
36 static void *image_load(struct kimage *image,
37 char *kernel, unsigned long kernel_len,
38 char *initrd, unsigned long initrd_len,
39 char *cmdline, unsigned long cmdline_len)
40 {
41 struct riscv_image_header *h;
42 u64 flags;
43 bool be_image, be_kernel;
44 struct kexec_buf kbuf;
45 int ret;
46
47 /* Check Image header */
48 h = (struct riscv_image_header *)kernel;
49 if (!h->image_size) {
50 ret = -EINVAL;
51 goto out;
52 }
53
54 /* Check endianness */
> 55 flags = le64_to_cpu(h->flags);
56 be_image = riscv_image_flag_field(flags, RISCV_IMAGE_FLAG_BE);
57 be_kernel = IS_ENABLED(CONFIG_CPU_BIG_ENDIAN);
58 if (be_image != be_kernel) {
59 ret = -EINVAL;
60 goto out;
61 }
62
63 /* Load the kernel image */
64 kbuf.image = image;
65 kbuf.buf_min = 0;
66 kbuf.buf_max = ULONG_MAX;
67 kbuf.top_down = false;
68
69 kbuf.buffer = kernel;
70 kbuf.bufsz = kernel_len;
71 kbuf.mem = KEXEC_BUF_MEM_UNKNOWN;
72 kbuf.memsz = le64_to_cpu(h->image_size);
73 kbuf.buf_align = le64_to_cpu(h->text_offset);
74
75 ret = kexec_add_buffer(&kbuf);
76 if (ret) {
77 pr_err("Error add kernel image ret=%d\n", ret);
78 goto out;
79 }
80
81 image->start = kbuf.mem;
82
83 pr_info("Loaded kernel at 0x%lx bufsz=0x%lx memsz=0x%lx\n",
84 kbuf.mem, kbuf.bufsz, kbuf.memsz);
85
86 ret = load_extra_segments(image, kbuf.mem, kbuf.memsz,
87 initrd, initrd_len, cmdline, cmdline_len);
88
89 out:
90 return ret ? ERR_PTR(ret) : NULL;
91 }
92
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Powered by blists - more mailing lists