Skip to contentSkip to conversation

common: Remove invalid endianess conversion

PATCH Superseded Christian Eggers 2 participants 2 messages Feb 5, 2014

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 common: Remove invalid endianess conversion

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.

---
 common/cmd_bootm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
common/cmd_bootm.c +2 -2
index a59ee95..c507e1d 100644
@@ -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;
 }
 
Signature · 1 line
1.8.4.5
#1 lore raw

PATCH 1/1 common: Remove invalid endianess conversion

Dear Christian Eggers,

Quoted 4 lines · In message <[email protected]> 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...

Quoted 10 lines
---
 common/cmd_bootm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
common/cmd_bootm.c +0 -0
index a59ee95..c507e1d 100644

common/cmd_bootm.c static int do_bootm_standalone(int flag, int argc, char * const argv[], · line 518

Quoted 7 lines
common/cmd_bootm.c +2 -2
@@ -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

Signature · 5 lines
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