From: Andre Heider <a.heider@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/3] fs: cbfs: fix locating the cbfs header
Date: Thu, 15 Feb 2018 07:40:11 +0100 [thread overview]
Message-ID: <20180215064012.28557-2-a.heider@gmail.com> (raw)
In-Reply-To: <20180215064012.28557-1-a.heider@gmail.com>
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>
---
fs/cbfs/cbfs.c | 4 ++--
1 file 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 >
--
2.16.1
next prev parent reply other threads:[~2018-02-15 6:40 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-15 6:40 [U-Boot] [PATCH 1/3] cmd: cbfs: fix reading the end_of_rom pointer for 64bit archs Andre Heider
2018-02-15 6:40 ` Andre Heider [this message]
2018-02-22 0:08 ` [U-Boot] [PATCH 2/3] fs: cbfs: fix locating the cbfs header Alexander Graf
2018-04-01 14:19 ` Simon Glass
2018-04-01 14:28 ` Simon Glass
2018-02-15 6:40 ` [U-Boot] [PATCH 3/3] cbfs: add support for cbfs header components Andre Heider
2018-02-22 0:15 ` Alexander Graf
2018-04-01 14:19 ` Simon Glass
2018-02-21 23:59 ` [U-Boot] [PATCH 1/3] cmd: cbfs: fix reading the end_of_rom pointer for 64bit archs Alexander Graf
2018-04-01 14:28 ` Simon Glass
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180215064012.28557-2-a.heider@gmail.com \
--to=a.heider@gmail.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox