[coreboot-gerrit] New patch to review for coreboot: cbfstool: fix address truncated problem

Patrick Georgi (pgeorgi@google.com) gerrit at coreboot.org
Wed Jan 13 18:43:38 CET 2016


Patrick Georgi (pgeorgi at google.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/12927

-gerrit

commit a9ddb9d70e807411fb6205e2040ffd5822c59d07
Author: HC Yen <hc.yen at mediatek.com>
Date:   Thu Jan 22 09:57:34 2015 +0800

    cbfstool: fix address truncated problem
    
    In parse_elf_to_stage(), it uses 32-bit variable to handle address.
    The correct address type is Elf64_Addr. Use uint64_t to prevent address
    to be truncated.
    
    BUG=none
    TEST=emerge-oak coreboot
    BRANCH=none
    
    Change-Id: I1abcd16899a69b18dd10e9678e767b0564b2846e
    Signed-off-by: Patrick Georgi <pgeorgi at chromium.org>
    Original-Commit-Id: ebc1aae0ae4ca30802a80a4a4e2ae0c0dad4d88a
    Original-Change-Id: I21f8057ddf13e442f1cf55da6702c3449ba0cc35
    Original-Reviewed-on: https://chromium-review.googlesource.com/292553
    Original-Commit-Ready: Yidi Lin <yidi.lin at mediatek.com>
    Original-Tested-by: Yidi Lin <yidi.lin at mediatek.com>
    Original-Reviewed-by: Aaron Durbin <adurbin at chromium.org>
    Original-Reviewed-by: Julius Werner <jwerner at chromium.org>
---
 util/cbfstool/cbfs-mkstage.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/util/cbfstool/cbfs-mkstage.c b/util/cbfstool/cbfs-mkstage.c
index b156350..9d88658 100644
--- a/util/cbfstool/cbfs-mkstage.c
+++ b/util/cbfstool/cbfs-mkstage.c
@@ -121,7 +121,7 @@ int parse_elf_to_stage(const struct buffer *input, struct buffer *output,
 
 	int headers;
 	int i, outlen;
-	uint32_t data_start, data_end, mem_end;
+	uint64_t data_start, data_end, mem_end;
 
 	comp_func_ptr compress = compression_function(algo);
 	if (!compress)
@@ -159,7 +159,7 @@ int parse_elf_to_stage(const struct buffer *input, struct buffer *output,
 	virt_to_phys = 0;
 
 	for (i = 0; i < headers; i++) {
-		unsigned int start, mend, rend;
+		uint64_t start, mend, rend;
 
 		if (phdr[i].p_type != PT_LOAD)
 			continue;
@@ -210,7 +210,7 @@ int parse_elf_to_stage(const struct buffer *input, struct buffer *output,
 	/* Copy the file data into the buffer */
 
 	for (i = 0; i < headers; i++) {
-		unsigned int l_start, l_offset = 0;
+		uint64_t l_start, l_offset = 0;
 
 		if (phdr[i].p_type != PT_LOAD)
 			continue;



More information about the coreboot-gerrit mailing list