[rtems commit] rtems-fdt/rtems-fdt.c: Fix bug in loop termination

Christian Mauderer christianm at rtems.org
Sun Mar 21 11:40:21 UTC 2021


Module:    rtems
Branch:    5
Commit:    08f807e64a2bf34a716a27cdfde022664979b46a
Changeset: http://git.rtems.org/rtems/commit/?id=08f807e64a2bf34a716a27cdfde022664979b46a

Author:    G S Niteesh Babu <niteesh.gs at gmail.com>
Date:      Thu Mar 18 08:38:56 2021 +0530

rtems-fdt/rtems-fdt.c: Fix bug in loop termination

The while loop, loops infinitely in case of raw FDT data.
The loop condition (size) is not modified during iterations.

Fixes #4350

---

 cpukit/libmisc/rtems-fdt/rtems-fdt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cpukit/libmisc/rtems-fdt/rtems-fdt.c b/cpukit/libmisc/rtems-fdt/rtems-fdt.c
index 39e70bf..b96ccbc 100644
--- a/cpukit/libmisc/rtems-fdt/rtems-fdt.c
+++ b/cpukit/libmisc/rtems-fdt/rtems-fdt.c
@@ -582,7 +582,7 @@ rtems_fdt_load (const char* filename, rtems_fdt_handle* handle)
         close (bf);
         return -RTEMS_FDT_ERR_READ_FAIL;
       }
-      r -= size;
+      size -= r;
       buf += r;
     }
   }



More information about the vc mailing list