[U-Boot] [PATCH] fix get_ram_size memory corruption

Gerd Hoffmann kraxel at redhat.com
Tue Oct 21 09:02:25 CEST 2014


base[0] is saved, but never restored.

Signed-off-by: Gerd Hoffmann <kraxel at redhat.com>
---
 common/memsize.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/common/memsize.c b/common/memsize.c
index 589400d..8bda2ba 100644
--- a/common/memsize.c
+++ b/common/memsize.c
@@ -48,7 +48,9 @@ long get_ram_size(long *base, long maxsize)
 	*addr = 0;
 
 	sync ();
-	if ((val = *addr) != 0) {
+	val = *addr;
+	*addr = save[i];
+	if ((val = 0) != 0) {
 		/* Restore the original data before leaving the function.
 		 */
 		sync ();
-- 
1.8.3.1



More information about the U-Boot mailing list