redboot fis_free patch

Andrew Lunn andrew@lunn.ch
Fri Jun 25 15:48:00 GMT 2004


On Fri, Jun 18, 2004 at 04:35:52PM +0200, Laurent GONZALEZ wrote:
> Hello list,
> 
> I caught an endless loop in flash.c (fis_free).
> It happens when the code removes a 'just collapsed' chunk from chunk
> table.

I personally don't like for statements like you used, so i added an
increment statement. I also fixed a compiler warning.

Thanks for reporting the bug.

        Andrew
-------------- next part --------------
Index: redboot/current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/redboot/current/ChangeLog,v
retrieving revision 1.198
diff -u -r1.198 ChangeLog
--- redboot/current/ChangeLog	31 May 2004 07:55:28 -0000	1.198
+++ redboot/current/ChangeLog	25 Jun 2004 15:45:14 -0000
@@ -1,3 +1,9 @@
+2004-06-25  Andrew Lunn  <andrew.lunn@ascom.ch>
+
+	* src/flash.c (find_free): fix endless loop when removing a
+	collapsed chunk from chunk table. Found by Laurent Gonzalez
+	(fis_load): Fixed a compiler warning.
+
 2004-05-31  Jani Monoses <jani@iv.ro>
 
 	* src/main.c:
Index: redboot/current/src/flash.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/redboot/current/src/flash.c,v
retrieving revision 1.66
diff -u -r1.66 flash.c
--- redboot/current/src/flash.c	5 May 2004 10:44:31 -0000	1.66
+++ redboot/current/src/flash.c	25 Jun 2004 15:45:17 -0000
@@ -547,6 +547,7 @@
                             // This free chunk has collapsed
                             while (idx < (num_chunks-1)) {
                                 chunks[idx] = chunks[idx+1];
+                                idx++;
                             }
                             num_chunks--;
                         }
@@ -1076,7 +1077,7 @@
         if (cksum != img->file_cksum) {
             diag_printf("** Warning - checksum failure.  stored: 0x%08lx, computed: 0x%08lx\n",
                         img->file_cksum, cksum);
-            entry_address = NO_MEMORY;
+            entry_address = (unsigned long)NO_MEMORY;
         }
     }
 #endif


More information about the Ecos-patches mailing list