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>
This commit is contained in:
HC Yen 2015-01-22 09:57:34 +08:00 committed by Patrick Georgi
parent f8970f53ef
commit 14ec199bd1
1 changed files with 3 additions and 3 deletions

View File

@ -121,7 +121,7 @@ int parse_elf_to_stage(const struct buffer *input, struct buffer *output,
int headers; int headers;
int i, outlen; 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); comp_func_ptr compress = compression_function(algo);
if (!compress) if (!compress)
@ -159,7 +159,7 @@ int parse_elf_to_stage(const struct buffer *input, struct buffer *output,
virt_to_phys = 0; virt_to_phys = 0;
for (i = 0; i < headers; i++) { for (i = 0; i < headers; i++) {
unsigned int start, mend, rend; uint64_t start, mend, rend;
if (phdr[i].p_type != PT_LOAD) if (phdr[i].p_type != PT_LOAD)
continue; continue;
@ -210,7 +210,7 @@ int parse_elf_to_stage(const struct buffer *input, struct buffer *output,
/* Copy the file data into the buffer */ /* Copy the file data into the buffer */
for (i = 0; i < headers; i++) { 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) if (phdr[i].p_type != PT_LOAD)
continue; continue;