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

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


The following commit(s) were added to refs/heads/master by this push:
     new 75b1358d8e modlib_bind.c: Restore "Relocation address out of range" 
checks
75b1358d8e is described below

commit 75b1358d8ebe6ea467401c5f73398b77f4779eb0
Author: YAMAMOTO Takashi <[email protected]>
AuthorDate: Mon Apr 4 13:21:17 2022 +0900

    modlib_bind.c: Restore "Relocation address out of range" checks
    
    Restore the checks which got completely broken by the following change.
    ```
    commit 15142a8b106bee8db6ac744b963969feba5c8289
    Author: anjiahao <[email protected]>
    Date:   Fri Apr 1 16:20:03 2022 +0800
    
        modlib/modlib_bind:fix unsigned_compare with zero
    
        Signed-off-by: anjiahao <[email protected]>
    ```
---
 libs/libc/modlib/modlib_bind.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/libs/libc/modlib/modlib_bind.c b/libs/libc/modlib/modlib_bind.c
index 925902ffbf..ab7ce2747d 100644
--- a/libs/libc/modlib/modlib_bind.c
+++ b/libs/libc/modlib/modlib_bind.c
@@ -297,8 +297,7 @@ static int modlib_relocate(FAR struct module_s *modp,
 
       /* Calculate the relocation address. */
 
-      if (rel->r_offset ||
-          rel->r_offset + sizeof(uint32_t) > dstsec->sh_size)
+      if (rel->r_offset + sizeof(uint32_t) > dstsec->sh_size)
         {
           berr("ERROR: Section %d reloc %d: "
                "Relocation address out of range, "
@@ -485,8 +484,7 @@ static int modlib_relocateadd(FAR struct module_s *modp,
 
       /* Calculate the relocation address. */
 
-      if (rela->r_offset ||
-          rela->r_offset + sizeof(uint32_t) > dstsec->sh_size)
+      if (rela->r_offset + sizeof(uint32_t) > dstsec->sh_size)
         {
           berr("ERROR: Section %d reloc %d: "
                "Relocation address out of range, "

Reply via email to