Skip to content

Commit 351bef1

Browse files
committed
tests: settings: Fix coverity issue CID 203623
Mask the value passed to memset() to avoid an error from Coverity. Fixes zephyrproject-rtos#18687. Signed-off-by: Carles Cufi <[email protected]>
1 parent 9103403 commit 351bef1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

tests/subsys/settings/fcb_init/src/settings_test_fcb_init.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,8 @@ void test_prepare_storage(void)
106106
err = flash_write_protection_set(dev, false);
107107
zassert_true(err == 0, "can't unprotect flash");
108108

109-
(void)memset(new_val, ~ERASED_VAL, DT_FLASH_WRITE_BLOCK_SIZE);
109+
(void)memset(new_val, (~ERASED_VAL) & 0xFF,
110+
DT_FLASH_WRITE_BLOCK_SIZE);
110111
err = flash_write(dev, (off_t)&prepared_mark, &new_val,
111112
sizeof(new_val));
112113
zassert_true(err == 0, "can't write prepared_mark");

0 commit comments

Comments
 (0)