diff mbox

[U-Boot] common: Remove invalid endianess conversion

Message ID 1391633046-8878-1-git-send-email-ceggers@gmx.de
State Superseded
Headers show

Commit Message

Christian Eggers Feb. 5, 2014, 8:44 p.m. UTC
do_bootm_standanlone() calls ntohl(images->ep) which is obviously wrong
(find . -name '*.c' | xargs grep -n -- 'images->ep'). Without this
conversion the code works correctly at least on ARM9. Addtionally "appl"
must not be dereferenced with the "*" operator.

Signed-off-by: Christian Eggers <ceggers@gmx.de>
---
 common/cmd_bootm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Wolfgang Denk Feb. 5, 2014, 10:09 p.m. UTC | #1
Dear Christian Eggers,

In message <1391633046-8878-1-git-send-email-ceggers@gmx.de> you wrote:
> do_bootm_standanlone() calls ntohl(images->ep) which is obviously wrong
> (find . -name '*.c' | xargs grep -n -- 'images->ep'). Without this
> conversion the code works correctly at least on ARM9. Addtionally "appl"
> must not be dereferenced with the "*" operator.

What makes you so sure that this is "obvious" ?  I think the image
header is actually supposed to be in network byte order...

> Signed-off-by: Christian Eggers <ceggers@gmx.de>
> ---
>  common/cmd_bootm.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
> index a59ee95..c507e1d 100644
> --- a/common/cmd_bootm.c
> +++ b/common/cmd_bootm.c
> @@ -514,8 +514,8 @@ static int do_bootm_standalone(int flag, int argc, char * const argv[],
>  		setenv_hex("filesize", images->os.image_len);
>  		return 0;
>  	}
> -	appl = (int (*)(int, char * const []))(ulong)ntohl(images->ep);
> -	(*appl)(argc, argv);
> +	appl = (int (*)(int, char * const []))images->ep;
> +	(appl)(argc, argv);

You are also making another change here - which looks as obscure to me
as the first one.

Can you please provide a test case which is fixed by your
modification?

Best regards,

Wolfgang Denk
diff mbox

Patch

diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
index a59ee95..c507e1d 100644
--- a/common/cmd_bootm.c
+++ b/common/cmd_bootm.c
@@ -514,8 +514,8 @@  static int do_bootm_standalone(int flag, int argc, char * const argv[],
 		setenv_hex("filesize", images->os.image_len);
 		return 0;
 	}
-	appl = (int (*)(int, char * const []))(ulong)ntohl(images->ep);
-	(*appl)(argc, argv);
+	appl = (int (*)(int, char * const []))images->ep;
+	(appl)(argc, argv);
 	return 0;
 }