From 351bef1dd288e748fea4e41c8afb2d57cf49bb57 Mon Sep 17 00:00:00 2001 From: Carles Cufi Date: Thu, 29 Aug 2019 17:21:43 +0200 Subject: [PATCH] tests: settings: Fix coverity issue CID 203623 Mask the value passed to memset() to avoid an error from Coverity. Fixes #18687. Signed-off-by: Carles Cufi --- tests/subsys/settings/fcb_init/src/settings_test_fcb_init.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/subsys/settings/fcb_init/src/settings_test_fcb_init.c b/tests/subsys/settings/fcb_init/src/settings_test_fcb_init.c index 8165409feb5..43a28c65258 100644 --- a/tests/subsys/settings/fcb_init/src/settings_test_fcb_init.c +++ b/tests/subsys/settings/fcb_init/src/settings_test_fcb_init.c @@ -106,7 +106,8 @@ void test_prepare_storage(void) err = flash_write_protection_set(dev, false); zassert_true(err == 0, "can't unprotect flash"); - (void)memset(new_val, ~ERASED_VAL, DT_FLASH_WRITE_BLOCK_SIZE); + (void)memset(new_val, (~ERASED_VAL) & 0xFF, + DT_FLASH_WRITE_BLOCK_SIZE); err = flash_write(dev, (off_t)&prepared_mark, &new_val, sizeof(new_val)); zassert_true(err == 0, "can't write prepared_mark");