diff options
author | Andre Heider <a.heider@gmail.com> | 2018-02-15 07:40:11 +0100 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2018-03-31 16:00:03 +0800 |
commit | 44683170f818ecaf914ea4c77d35021f60e38b04 (patch) | |
tree | 4a400696fd70cbece589899a4f8e4f7982ed5ef2 /fs | |
parent | 33222c8a2cef36d0651d85100d9e0eadbe73884c (diff) | |
download | u-boot-44683170f818ecaf914ea4c77d35021f60e38b04.tar.gz u-boot-44683170f818ecaf914ea4c77d35021f60e38b04.tar.bz2 u-boot-44683170f818ecaf914ea4c77d35021f60e38b04.zip |
fs: cbfs: fix locating the cbfs header
The value at the end of the rom is not a pointer, it is an offset
relative to the end of rom.
Signed-off-by: Andre Heider <a.heider@gmail.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/cbfs/cbfs.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/cbfs/cbfs.c b/fs/cbfs/cbfs.c index 6e1107d751..46da8f134f 100644 --- a/fs/cbfs/cbfs.c +++ b/fs/cbfs/cbfs.c @@ -168,9 +168,9 @@ static int file_cbfs_load_header(uintptr_t end_of_rom, struct cbfs_header *header) { struct cbfs_header *header_in_rom; + int32_t offset = *(u32 *)(end_of_rom - 3); - header_in_rom = (struct cbfs_header *)(uintptr_t) - *(u32 *)(end_of_rom - 3); + header_in_rom = (struct cbfs_header *)(end_of_rom + offset + 1); swap_header(header, header_in_rom); if (header->magic != good_magic || header->offset > |