This is an automated email from the ASF dual-hosted git repository.

GUIDINGLI pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 0f180207d5e libc/elf: drop the impossible negative r_offset check
0f180207d5e is described below

commit 0f180207d5e5c04b30b3b8d5f824878eb8f3af7d
Author: anjiahao <[email protected]>
AuthorDate: Thu Nov 26 23:37:34 2026 +0800

    libc/elf: drop the impossible negative r_offset check
    
    r_offset is an address type and cannot be negative, so the
    r_offset < 0 test is dead code that also raises a -Wtype-limits
    warning.  Keep only the upper bound check.
    
    Signed-off-by: anjiahao <[email protected]>
---
 libs/libc/elf/elf_bind.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/libs/libc/elf/elf_bind.c b/libs/libc/elf/elf_bind.c
index 7f2c715e8f3..c01e9894486 100644
--- a/libs/libc/elf/elf_bind.c
+++ b/libs/libc/elf/elf_bind.c
@@ -752,8 +752,7 @@ static int libelf_relocateadd(FAR struct module_s *modp,
 
       /* Calculate the relocation address. */
 
-      if (rela->r_offset < 0 ||
-          rela->r_offset > dstsec->sh_size)
+      if (rela->r_offset > dstsec->sh_size)
         {
           berr("ERROR: Section %d reloc %d: "
                "Relocation address out of range, "

Reply via email to