[U-Boot] [PATCH] common: Remove invalid endianess conversion

Wolfgang Denk wd at denx.de
Wed Feb 5 23:09:18 CET 2014


Dear Christian Eggers,

In message <1391633046-8878-1-git-send-email-ceggers at 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 at 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

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
If you can't explain it to a six year old, you  don't  understand  it
yourself.                                           - Albert Einstein


More information about the U-Boot mailing list