From 2adbed8d6d19b9f00a3e4ca38bae53e0c5e7b1e3 Mon Sep 17 00:00:00 2001 From: Andrzej Puzdrowski Date: Tue, 14 Nov 2017 12:34:11 +0100 Subject: [PATCH] tests: subsys: dfu: mcuboot: fix return value not handling issue Function flash_read was calling without checking return value. (Coverity CID: 178794) This patch cover this issue. Signed-off-by: Andrzej Puzdrowski --- tests/subsys/dfu/mcuboot/src/main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/subsys/dfu/mcuboot/src/main.c b/tests/subsys/dfu/mcuboot/src/main.c index 576d2d728bd..befebfe0cb4 100644 --- a/tests/subsys/dfu/mcuboot/src/main.c +++ b/tests/subsys/dfu/mcuboot/src/main.c @@ -28,7 +28,8 @@ void test_bank_erase(void) for (offs = FLASH_AREA_IMAGE_1_OFFSET; offs <= FLASH_AREA_IMAGE_1_OFFSET + FLASH_AREA_IMAGE_1_SIZE; offs += sizeof(temp)) { - flash_read(flash_dev, offs, &temp, sizeof(temp)); + ret = flash_read(flash_dev, offs, &temp, sizeof(temp)); + zassert_true(ret == 0, "Reading from flash"); if (temp != 0xFFFFFFFF) { ret = flash_write_protection_set(flash_dev, false); zassert_true(ret == 0, "Disabling flash protection");