From: Andre Heider Date: Thu, 15 Feb 2018 06:40:11 +0000 (+0100) Subject: fs: cbfs: fix locating the cbfs header X-Git-Tag: v2018.05-rc1~1^2~5 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=44683170f818ecaf914ea4c77d35021f60e38b04;p=u-boot 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 --- 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 >