summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorPali Rohár <pali@kernel.org>2023-01-21 15:59:20 +0300
committerStefan Roese <sr@denx.de>2023-03-01 08:39:17 +0300
commita2cd076b7f5ad3017fc8a2b22687cd58d02e85db (patch)
treec89557d0f220aa0e2dc681e77d762129a19c3aea /cmd
parentd4aa2104327fd8b6d46f7c51de1e35f5ec702c93 (diff)
downloadu-boot-a2cd076b7f5ad3017fc8a2b22687cd58d02e85db.tar.xz
cmd: mvebu/bubt: Fix parsing SATA kwbimage
Despite the official specification, Marvell BootROM does not interpret srcaddr from SATA image as number of sectors the beginning of the hard drive, but as number of sectors relative to the main header. Reject invalid and accept valid SATA images. Fixes: 5a0653493307 ("cmd: mvebu/bubt: Check for A38x image data checksum") Signed-off-by: Pali Rohár <pali@kernel.org>
Diffstat (limited to 'cmd')
-rw-r--r--cmd/mvebu/bubt.c8
1 files changed, 1 insertions, 7 deletions
diff --git a/cmd/mvebu/bubt.c b/cmd/mvebu/bubt.c
index 6bb84da03e..2bcdf145f6 100644
--- a/cmd/mvebu/bubt.c
+++ b/cmd/mvebu/bubt.c
@@ -738,14 +738,8 @@ static int check_image_header(void)
offset = le32_to_cpu(hdr->srcaddr);
size = le32_to_cpu(hdr->blocksize);
- if (hdr->blockid == 0x78) { /* SATA id */
- if (offset < 1) {
- printf("Error: Bad A38x image srcaddr.\n");
- return -ENOEXEC;
- }
- offset -= 1;
+ if (hdr->blockid == 0x78) /* SATA id */
offset *= 512;
- }
if (offset % 4 != 0 || size < 4 || size % 4 != 0) {
printf("Error: Bad A38x image blocksize.\n");