Skip to content

Commit

Permalink
fs: cbfs: fix locating the cbfs header
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
dhewg authored and sjg20 committed Mar 31, 2018
1 parent 33222c8 commit 4468317
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions fs/cbfs/cbfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 >
Expand Down

0 comments on commit 4468317

Please sign in to comment.