summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHC Yen <hc.yen@mediatek.com>2015-01-22 09:57:34 +0800
committerPatrick Georgi <pgeorgi@google.com>2016-01-14 18:43:54 +0100
commit14ec199bd190d11f5d141ae93be95aa53acbf7f0 (patch)
tree128490bf52092548bdb032c67505067a527dd8bb
parentf8970f53eff5114f819df84196efa4e4539cbba1 (diff)
downloadcoreboot-14ec199bd190d11f5d141ae93be95aa53acbf7f0.tar.xz
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@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@mediatek.com> Original-Tested-by: Yidi Lin <yidi.lin@mediatek.com> Original-Reviewed-by: Aaron Durbin <adurbin@chromium.org> Original-Reviewed-by: Julius Werner <jwerner@chromium.org> Reviewed-on: https://review.coreboot.org/12927 Tested-by: build bot (Jenkins) Reviewed-by: Martin Roth <martinroth@google.com>
-rw-r--r--util/cbfstool/cbfs-mkstage.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/util/cbfstool/cbfs-mkstage.c b/util/cbfstool/cbfs-mkstage.c
index b1563500bf..9d8865828e 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;