[PATCH] kexec_core: Remove superfluous page offset handling in segment loading
kernel test robot
lkp at intel.com
Thu Sep 11 06:24:23 PDT 2025
Hi Justinien,
kernel test robot noticed the following build warnings:
[auto build test WARNING on akpm-mm/mm-everything]
[also build test WARNING on linus/master v6.17-rc5 next-20250911]
[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/Justinien-Bouron/kexec_core-Remove-superfluous-page-offset-handling-in-segment-loading/20250911-003354
base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything
patch link: https://lore.kernel.org/r/20250910163116.49148-1-jbouron%40amazon.com
patch subject: [PATCH] kexec_core: Remove superfluous page offset handling in segment loading
config: x86_64-buildonly-randconfig-004-20250911 (https://download.01.org/0day-ci/archive/20250911/202509112118.1NElSKNk-lkp@intel.com/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250911/202509112118.1NElSKNk-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 at intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202509112118.1NElSKNk-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> kernel/kexec_core.c:745:16: warning: variable 'maddr' set but not used [-Wunused-but-set-variable]
745 | unsigned long maddr;
| ^
1 warning generated.
vim +/maddr +745 kernel/kexec_core.c
2965faa5e03d1e Dave Young 2015-09-09 739
07d24902977e47 Alexander Graf 2025-06-10 740 static int kimage_load_cma_segment(struct kimage *image, int idx)
07d24902977e47 Alexander Graf 2025-06-10 741 {
07d24902977e47 Alexander Graf 2025-06-10 742 struct kexec_segment *segment = &image->segment[idx];
07d24902977e47 Alexander Graf 2025-06-10 743 struct page *cma = image->segment_cma[idx];
07d24902977e47 Alexander Graf 2025-06-10 744 char *ptr = page_address(cma);
07d24902977e47 Alexander Graf 2025-06-10 @745 unsigned long maddr;
07d24902977e47 Alexander Graf 2025-06-10 746 size_t ubytes, mbytes;
07d24902977e47 Alexander Graf 2025-06-10 747 int result = 0;
07d24902977e47 Alexander Graf 2025-06-10 748 unsigned char __user *buf = NULL;
07d24902977e47 Alexander Graf 2025-06-10 749 unsigned char *kbuf = NULL;
07d24902977e47 Alexander Graf 2025-06-10 750
07d24902977e47 Alexander Graf 2025-06-10 751 if (image->file_mode)
07d24902977e47 Alexander Graf 2025-06-10 752 kbuf = segment->kbuf;
07d24902977e47 Alexander Graf 2025-06-10 753 else
07d24902977e47 Alexander Graf 2025-06-10 754 buf = segment->buf;
07d24902977e47 Alexander Graf 2025-06-10 755 ubytes = segment->bufsz;
07d24902977e47 Alexander Graf 2025-06-10 756 mbytes = segment->memsz;
07d24902977e47 Alexander Graf 2025-06-10 757 maddr = segment->mem;
07d24902977e47 Alexander Graf 2025-06-10 758
07d24902977e47 Alexander Graf 2025-06-10 759 /* Then copy from source buffer to the CMA one */
07d24902977e47 Alexander Graf 2025-06-10 760 while (mbytes) {
07d24902977e47 Alexander Graf 2025-06-10 761 size_t uchunk, mchunk;
07d24902977e47 Alexander Graf 2025-06-10 762
b4cdefb6ef1453 Justinien Bouron 2025-09-10 763 mchunk = min_t(size_t, mbytes, PAGE_SIZE);
07d24902977e47 Alexander Graf 2025-06-10 764 uchunk = min(ubytes, mchunk);
07d24902977e47 Alexander Graf 2025-06-10 765
07d24902977e47 Alexander Graf 2025-06-10 766 if (uchunk) {
07d24902977e47 Alexander Graf 2025-06-10 767 /* For file based kexec, source pages are in kernel memory */
07d24902977e47 Alexander Graf 2025-06-10 768 if (image->file_mode)
07d24902977e47 Alexander Graf 2025-06-10 769 memcpy(ptr, kbuf, uchunk);
07d24902977e47 Alexander Graf 2025-06-10 770 else
07d24902977e47 Alexander Graf 2025-06-10 771 result = copy_from_user(ptr, buf, uchunk);
07d24902977e47 Alexander Graf 2025-06-10 772 ubytes -= uchunk;
07d24902977e47 Alexander Graf 2025-06-10 773 if (image->file_mode)
07d24902977e47 Alexander Graf 2025-06-10 774 kbuf += uchunk;
07d24902977e47 Alexander Graf 2025-06-10 775 else
07d24902977e47 Alexander Graf 2025-06-10 776 buf += uchunk;
07d24902977e47 Alexander Graf 2025-06-10 777 }
07d24902977e47 Alexander Graf 2025-06-10 778
07d24902977e47 Alexander Graf 2025-06-10 779 if (result) {
07d24902977e47 Alexander Graf 2025-06-10 780 result = -EFAULT;
07d24902977e47 Alexander Graf 2025-06-10 781 goto out;
07d24902977e47 Alexander Graf 2025-06-10 782 }
07d24902977e47 Alexander Graf 2025-06-10 783
07d24902977e47 Alexander Graf 2025-06-10 784 ptr += mchunk;
07d24902977e47 Alexander Graf 2025-06-10 785 maddr += mchunk;
07d24902977e47 Alexander Graf 2025-06-10 786 mbytes -= mchunk;
07d24902977e47 Alexander Graf 2025-06-10 787
07d24902977e47 Alexander Graf 2025-06-10 788 cond_resched();
07d24902977e47 Alexander Graf 2025-06-10 789 }
07d24902977e47 Alexander Graf 2025-06-10 790
07d24902977e47 Alexander Graf 2025-06-10 791 /* Clear any remainder */
07d24902977e47 Alexander Graf 2025-06-10 792 memset(ptr, 0, mbytes);
07d24902977e47 Alexander Graf 2025-06-10 793
07d24902977e47 Alexander Graf 2025-06-10 794 out:
07d24902977e47 Alexander Graf 2025-06-10 795 return result;
07d24902977e47 Alexander Graf 2025-06-10 796 }
07d24902977e47 Alexander Graf 2025-06-10 797
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
More information about the kexec
mailing list