[U-Boot] [PATCH] common: Fix source command on 64-bit architectures

Thierry Reding thierry.reding at gmail.com
Fri Mar 20 12:53:42 CET 2015


From: Thierry Reding <treding at nvidia.com>

The source command uses an unsigned long to iterate over the 32-bit
lengths array contained in the legacy image format. On architectures
where unsigned long is 64-bit this fails to find the correct entry
point of a script.

Cc: Tom Rini <trini at konsulko.com>
Signed-off-by: Thierry Reding <treding at nvidia.com>
---
 common/cmd_source.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/common/cmd_source.c b/common/cmd_source.c
index 6881bc9ddd33..5f550a525430 100644
--- a/common/cmd_source.c
+++ b/common/cmd_source.c
@@ -32,7 +32,7 @@ source (ulong addr, const char *fit_uname)
 #if defined(CONFIG_IMAGE_FORMAT_LEGACY)
 	const image_header_t *hdr;
 #endif
-	ulong		*data;
+	u32		*data;
 	int		verify;
 	void *buf;
 #if defined(CONFIG_FIT)
@@ -73,7 +73,7 @@ source (ulong addr, const char *fit_uname)
 		}
 
 		/* get length of script */
-		data = (ulong *)image_get_data (hdr);
+		data = (u32 *)image_get_data (hdr);
 
 		if ((len = uimage_to_cpu (*data)) == 0) {
 			puts ("Empty Script\n");
-- 
2.3.2



More information about the U-Boot mailing list