Skip to content

Commit 7bc947d

Browse files
dgarskedanielinux
authored andcommitted
Fix logic on ext_flash_check_read return code (it is supposed to return size read or decrypted).
1 parent 73fc193 commit 7bc947d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/image.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1511,7 +1511,7 @@ static int read_flash_fwimage(struct wolfBoot_image* img, uint32_t offset,
15111511
#ifdef EXT_FLASH
15121512
if (PART_IS_EXT(img)) {
15131513
if (ext_flash_check_read((uintptr_t)img->fw_base + offset, buffer,
1514-
size) != 0) {
1514+
size) < 0) {
15151515
wolfBoot_printf(
15161516
"ERROR: ext_flash_check_read failed at offset %lu, size %u\n",
15171517
(unsigned long)offset, size);
@@ -1539,7 +1539,7 @@ static int read_flash_addr(void* src, void* buffer, uint32_t size, int src_ext)
15391539

15401540
#ifdef EXT_FLASH
15411541
if (src_ext) {
1542-
if (ext_flash_check_read((uintptr_t)src, buffer, size) != 0) {
1542+
if (ext_flash_check_read((uintptr_t)src, buffer, size) < 0) {
15431543
wolfBoot_printf(
15441544
"ERROR: ext_flash_check_read failed at address %p, size %u\n",
15451545
src, size);

0 commit comments

Comments
 (0)