public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] mkimage: SEGFAULT with imximage on 64 bit systems
@ 2010-01-29 10:22 Stefano Babic
  2010-01-29 16:04 ` Mike Frysinger
  2010-02-05 14:16 ` [U-Boot] [PATCH V2] " Stefano Babic
  0 siblings, 2 replies; 6+ messages in thread
From: Stefano Babic @ 2010-01-29 10:22 UTC (permalink / raw)
  To: u-boot

Running mkimage to generate an imximage produces a SEGFAULT
on 64 bit machines due to pointer arithmetic limited to 32 bit.

Signed-off-by: Stefano Babic <sbabic@denx.de>
---
 tools/imximage.c |   10 +++++-----
 tools/imximage.h |    2 +-
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/tools/imximage.c b/tools/imximage.c
index 59923ff..76cd903 100644
--- a/tools/imximage.c
+++ b/tools/imximage.c
@@ -111,7 +111,7 @@ static void imximage_print_header(const void *ptr)
 		exit(EXIT_FAILURE);
 	}
 
-	ext_header = (flash_cfg_parms_t *) ((uint32_t)&imx_hdr->dcd_table +
+	ext_header = (flash_cfg_parms_t *) ((uint64_t)&imx_hdr->dcd_table +
 			sizeof(dcd_preamble_t) + size);
 
 	printf("Image Type:   Freescale IMX Boot Image\n");
@@ -264,15 +264,15 @@ static void imximage_set_header(void *ptr, struct stat *sbuf, int ifd,
 	fhdr->app_code_jump_vector = params->ep;
 
 	base_offset = fhdr->app_dest_ptr + hdr->flash_offset ;
-	fhdr->dcd_ptr_ptr = (uint32_t) ((uint32_t)&fhdr->dcd_ptr -
-		(uint32_t)&fhdr->app_code_jump_vector) + base_offset ;
+	fhdr->dcd_ptr_ptr = (uint32_t) ((uint64_t)&fhdr->dcd_ptr -
+		(uint64_t)&fhdr->app_code_jump_vector) + base_offset ;
 
 	fhdr->dcd_ptr = base_offset +
 			((uint32_t)&hdr->dcd_table -
 			(uint32_t)&hdr->fhdr);
 
 	/* The external flash header must be at the end of the DCD table */
-	ext_header = (flash_cfg_parms_t *) ((uint32_t)&hdr->dcd_table +
+	ext_header = (flash_cfg_parms_t *) ((uint64_t)&hdr->dcd_table +
 			dcd_len +
 			sizeof(dcd_preamble_t));
 	ext_header->length = sbuf->st_size +
@@ -281,7 +281,7 @@ static void imximage_set_header(void *ptr, struct stat *sbuf, int ifd,
 
 	/* Security feature are not supported */
 	fhdr->app_code_csf = 0;
-	fhdr->super_root_key = NULL;
+	fhdr->super_root_key = 0;
 
 }
 
diff --git a/tools/imximage.h b/tools/imximage.h
index c579f51..b4d926d 100644
--- a/tools/imximage.h
+++ b/tools/imximage.h
@@ -81,7 +81,7 @@ typedef struct {
 	uint32_t app_code_barker;
 	uint32_t app_code_csf;
 	uint32_t dcd_ptr_ptr;
-	hab_rsa_public_key *super_root_key;
+	uint32_t super_root_key;
 	uint32_t dcd_ptr;
 	uint32_t app_dest_ptr;
 } flash_header_t;
-- 
1.6.3.3

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

end of thread, other threads:[~2010-02-23 23:07 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-29 10:22 [U-Boot] [PATCH] mkimage: SEGFAULT with imximage on 64 bit systems Stefano Babic
2010-01-29 16:04 ` Mike Frysinger
2010-01-29 16:57   ` Stefano Babic
2010-02-05 14:16 ` [U-Boot] [PATCH V2] " Stefano Babic
2010-02-23  1:34   ` Kim Phillips
2010-02-23 23:07   ` Wolfgang Denk

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