Skip to content

Commit 7246f8b

Browse files
committed
Fix logic on ext_flash_check_read return code (it is supposed to return size read or decrypted).
1 parent eed01dc commit 7246f8b

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
@@ -1446,7 +1446,7 @@ static int read_flash_fwimage(struct wolfBoot_image* img, uint32_t offset,
14461446
#ifdef EXT_FLASH
14471447
if (PART_IS_EXT(img)) {
14481448
if (ext_flash_check_read((uintptr_t)img->fw_base + offset, buffer,
1449-
size) != 0) {
1449+
size) < 0) {
14501450
wolfBoot_printf(
14511451
"ERROR: ext_flash_check_read failed at offset %lu, size %u\n",
14521452
(unsigned long)offset, size);
@@ -1474,7 +1474,7 @@ static int read_flash_addr(void* src, void* buffer, uint32_t size, int src_ext)
14741474

14751475
#ifdef EXT_FLASH
14761476
if (src_ext) {
1477-
if (ext_flash_check_read((uintptr_t)src, buffer, size) != 0) {
1477+
if (ext_flash_check_read((uintptr_t)src, buffer, size) < 0) {
14781478
wolfBoot_printf(
14791479
"ERROR: ext_flash_check_read failed at address %p, size %u\n",
14801480
src, size);

0 commit comments

Comments
 (0)