mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2025-09-28 09:11:34 +02:00
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>
This commit is contained in:
parent
d4aa210432
commit
a2cd076b7f
@ -738,14 +738,8 @@ static int check_image_header(void)
|
|||||||
offset = le32_to_cpu(hdr->srcaddr);
|
offset = le32_to_cpu(hdr->srcaddr);
|
||||||
size = le32_to_cpu(hdr->blocksize);
|
size = le32_to_cpu(hdr->blocksize);
|
||||||
|
|
||||||
if (hdr->blockid == 0x78) { /* SATA id */
|
if (hdr->blockid == 0x78) /* SATA id */
|
||||||
if (offset < 1) {
|
|
||||||
printf("Error: Bad A38x image srcaddr.\n");
|
|
||||||
return -ENOEXEC;
|
|
||||||
}
|
|
||||||
offset -= 1;
|
|
||||||
offset *= 512;
|
offset *= 512;
|
||||||
}
|
|
||||||
|
|
||||||
if (offset % 4 != 0 || size < 4 || size % 4 != 0) {
|
if (offset % 4 != 0 || size < 4 || size % 4 != 0) {
|
||||||
printf("Error: Bad A38x image blocksize.\n");
|
printf("Error: Bad A38x image blocksize.\n");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user