All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Samuel Holland <samuel.holland@sifive.com>
Cc: oe-kbuild-all@lists.linux.dev, linux-kernel@vger.kernel.org,
	Palmer Dabbelt <palmer@rivosinc.com>
Subject: arch/riscv/mm/init.c:356 relocate_kernel() warn: always true condition '(relocated_addr >= (((0)))) => (0-u64max >= 0)'
Date: Thu, 18 Dec 2025 14:20:00 +0800	[thread overview]
Message-ID: <202512181449.vp2Fwpvr-lkp@intel.com> (raw)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   ea1013c1539270e372fc99854bc6e4d94eaeff66
commit: 51b766c79a3d741fb97419c3da1c58fce5e66f0e riscv: Support CONFIG_RELOCATABLE on NOMMU
date:   9 months ago
config: riscv-randconfig-r072-20251218 (https://download.01.org/0day-ci/archive/20251218/202512181449.vp2Fwpvr-lkp@intel.com/config)
compiler: clang version 22.0.0git (https://github.com/llvm/llvm-project 1335a05ab8bc8339ce24be3a9da89d8c3f4e0571)

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/202512181449.vp2Fwpvr-lkp@intel.com/

smatch warnings:
arch/riscv/mm/init.c:356 relocate_kernel() warn: always true condition '(relocated_addr >= (((0)))) => (0-u64max >= 0)'

vim +356 arch/riscv/mm/init.c

   328	
   329	static void __init relocate_kernel(void)
   330	{
   331		Elf64_Rela *rela = (Elf64_Rela *)&__rela_dyn_start;
   332		/*
   333		 * This holds the offset between the linked virtual address and the
   334		 * relocated virtual address.
   335		 */
   336		uintptr_t reloc_offset = kernel_map.virt_addr - KERNEL_LINK_ADDR;
   337		/*
   338		 * This holds the offset between kernel linked virtual address and
   339		 * physical address.
   340		 */
   341		uintptr_t va_kernel_link_pa_offset = KERNEL_LINK_ADDR - kernel_map.phys_addr;
   342	
   343		for ( ; rela < (Elf64_Rela *)&__rela_dyn_end; rela++) {
   344			Elf64_Addr addr = (rela->r_offset - va_kernel_link_pa_offset);
   345			Elf64_Addr relocated_addr = rela->r_addend;
   346	
   347			if (rela->r_info != R_RISCV_RELATIVE)
   348				continue;
   349	
   350			/*
   351			 * Make sure to not relocate vdso symbols like rt_sigreturn
   352			 * which are linked from the address 0 in vmlinux since
   353			 * vdso symbol addresses are actually used as an offset from
   354			 * mm->context.vdso in VDSO_OFFSET macro.
   355			 */
 > 356			if (relocated_addr >= KERNEL_LINK_ADDR)
   357				relocated_addr += reloc_offset;
   358	
   359			*(Elf64_Addr *)addr = relocated_addr;
   360		}
   361	}
   362	#endif /* CONFIG_RELOCATABLE */
   363	

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

             reply	other threads:[~2025-12-18  6:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-18  6:20 kernel test robot [this message]
  -- strict thread matches above, loose matches on Subject: below --
2026-04-20  1:44 arch/riscv/mm/init.c:356 relocate_kernel() warn: always true condition '(relocated_addr >= (((0)))) => (0-u64max >= 0)' kernel test robot
2025-05-24 23:33 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=202512181449.vp2Fwpvr-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=palmer@rivosinc.com \
    --cc=samuel.holland@sifive.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.