common: Fix source command on 64-bit architectures
PATCH 1/1 common: Fix source command on 64-bit architectures
From: Thierry Reding <[email protected]>
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.
--- common/cmd_source.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
common/cmd_source.c +2 -2
@@ -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" );
Signature · 1 line
2.3.2
Quoted 27 lines · Thierry Reding
From: Thierry Reding <[email protected]>
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 <[email protected]>Signed-off-by Thierry Reding <[email protected]>--- common/cmd_source.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)common/cmd_source.c +1
-1@@ -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 )
common/cmd_source.c source (ulong addr, const char *fit_uname) · line 79
Quoted 8 lines
common/cmd_source.c +1
-1@@ -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" );
On PowerPC this causes:
powerpc: + T1042RDB_PI
+(T1042RDB_PI) data = (ulong *)fit_data;
+(T1042RDB_PI) ^
w+(T1042RDB_PI) ../common/cmd_source.c: In function 'source':
w+(T1042RDB_PI) ../common/cmd_source.c:130:8: warning: assignment from incompatible pointer type [enabled by default]
(and of course a number of similar boards).
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150328/66b31308/attachment.sig>