U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] common: Fix source command on 64-bit architectures
@ 2015-03-20 11:53 Thierry Reding
  2015-03-28 16:02 ` [U-Boot] " Tom Rini
  0 siblings, 1 reply; 2+ messages in thread
From: Thierry Reding @ 2015-03-20 11:53 UTC (permalink / raw)
  To: u-boot

From: Thierry Reding <treding@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@konsulko.com>
Signed-off-by: Thierry Reding <treding@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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [U-Boot] common: Fix source command on 64-bit architectures
  2015-03-20 11:53 [U-Boot] [PATCH] common: Fix source command on 64-bit architectures Thierry Reding
@ 2015-03-28 16:02 ` Tom Rini
  0 siblings, 0 replies; 2+ messages in thread
From: Tom Rini @ 2015-03-28 16:02 UTC (permalink / raw)
  To: u-boot

On Fri, Mar 20, 2015 at 12:53:42PM +0100, Thierry Reding wrote:

> From: Thierry Reding <treding@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@konsulko.com>
> Signed-off-by: Thierry Reding <treding@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");

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).

-- 
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>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-03-28 16:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-20 11:53 [U-Boot] [PATCH] common: Fix source command on 64-bit architectures Thierry Reding
2015-03-28 16:02 ` [U-Boot] " Tom Rini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox