Hi Youling,

kernel test robot noticed the following build warnings:

[auto build test WARNING on linus/master]
[also build test WARNING on v6.17-rc3 next-20250825]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    
https://github.com/intel-lab-lkp/linux/commits/Youling-Tang/LoongArch-Add-struct-loongarch_image_header-for-kernel-image/20250820-140025
base:   linus/master
patch link:    
https://lore.kernel.org/r/20250820055700.24344-3-youling.tang%40linux.dev
patch subject: [PATCH v2 2/5] LoongArch: Add kexec_file support
config: loongarch-randconfig-r121-20250826 
(https://download.01.org/0day-ci/archive/20250826/202508260914.bjz2yqws-...@intel.com/config)
compiler: clang version 18.1.8 (https://github.com/llvm/llvm-project 
3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff)
reproduce: 
(https://download.01.org/0day-ci/archive/20250826/202508260914.bjz2yqws-...@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 <l...@intel.com>
| Closes: 
https://lore.kernel.org/oe-kbuild-all/202508260914.bjz2yqws-...@intel.com/

sparse warnings: (new ones prefixed by >>)
>> arch/loongarch/kernel/kexec_efi.c:61:22: sparse: sparse: cast to restricted 
>> __le64
   arch/loongarch/kernel/kexec_efi.c:62:23: sparse: sparse: cast to restricted 
__le64

vim +61 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          struct loongarch_image_header *h;
    44          struct kexec_buf kbuf;
    45          unsigned long text_offset, kernel_segment_number;
    46          struct kexec_segment *kernel_segment;
    47          int ret;
    48  
    49          h = (struct loongarch_image_header *)kernel;
    50          if (!h->image_size)
    51                  return ERR_PTR(-EINVAL);
    52  
    53          /* Load the kernel */
    54          kbuf.image = image;
    55          kbuf.buf_max = ULONG_MAX;
    56          kbuf.top_down = false;
    57  
    58          kbuf.buffer = kernel;
    59          kbuf.bufsz = kernel_len;
    60          kbuf.mem = KEXEC_BUF_MEM_UNKNOWN;
  > 61          kbuf.memsz = le64_to_cpu(h->image_size);
    62          text_offset = le64_to_cpu(h->text_offset);
    63          kbuf.buf_min = text_offset;
    64          kbuf.buf_align = SZ_2M;
    65  
    66          kernel_segment_number = image->nr_segments;
    67  
    68          /*
    69           * The location of the kernel segment may make it impossible to 
satisfy
    70           * the other segment requirements, so we try repeatedly to find 
a
    71           * location that will work.
    72           */
    73          while ((ret = kexec_add_buffer(&kbuf)) == 0) {
    74                  /* Try to load additional data */
    75                  kernel_segment = &image->segment[kernel_segment_number];
    76                  ret = load_other_segments(image, kernel_segment->mem,
    77                                            kernel_segment->memsz, initrd,
    78                                            initrd_len, cmdline, 
cmdline_len);
    79                  if (!ret)
    80                          break;
    81  
    82                  /*
    83                   * We couldn't find space for the other segments; erase 
the
    84                   * kernel segment and try the next available hole.
    85                   */
    86                  image->nr_segments -= 1;
    87                  kbuf.buf_min = kernel_segment->mem + 
kernel_segment->memsz;
    88                  kbuf.mem = KEXEC_BUF_MEM_UNKNOWN;
    89          }
    90  
    91          if (ret) {
    92                  pr_err("Could not find any suitable kernel location!");
    93                  return ERR_PTR(ret);
    94          }
    95  
    96          kernel_segment = &image->segment[kernel_segment_number];
    97  
    98          /* Make sure the second kernel jumps to the correct 
"kernel_entry". */
    99          image->start = kernel_segment->mem + h->kernel_entry - 
text_offset;
   100  
   101          kexec_dprintk("Loaded kernel at 0x%lx bufsz=0x%lx 
memsz=0x%lx\n",
   102                        kernel_segment->mem, kbuf.bufsz,
   103                        kernel_segment->memsz);
   104  
   105          return NULL;
   106  }
   107  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

Reply via email to