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

G S Niteesh Babu niteesh.gs at gmail.com
Thu Mar 18 02:50:56 UTC 2021


The while loop, loops infinitely in case of raw FDT data.
The loop condition (size) is not modified during iterations.
---
 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 0ea365314f..7747ba9bf8 100644
--- a/cpukit/libmisc/rtems-fdt/rtems-fdt.c
+++ b/cpukit/libmisc/rtems-fdt/rtems-fdt.c
@@ -580,7 +580,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;
     }
   }
-- 
2.17.1



More information about the devel mailing list