From: Jan Kiszka <[email protected]>
We don't have control over the ck_assert_str_eq macro, so feed it with a
variable pointer, rather than the array directly. This silences
tools/tests/test_uservars.c:90:2: warning: Either the condition
'_ck_y!=((void*)0)' is redundant or there is possible null pointer
dereference: _ck_y. [nullPointerRedundantCheck]
Furthermore, drop unused variables.
Signed-off-by: Jan Kiszka <[email protected]>
---
tools/tests/test_uservars.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/tools/tests/test_uservars.c b/tools/tests/test_uservars.c
index e3fedcf..edafac6 100644
--- a/tools/tests/test_uservars.c
+++ b/tools/tests/test_uservars.c
@@ -63,9 +63,6 @@ START_TEST(bgenv_get_from_manipulated)
int fd = mkstemp(configfilepath);
ck_assert_int_ne(fd, -1);
- BGENV bgenv = {.desc = configfilepath, .data = &data};
- ebgenv_t e = {.bgenv = &bgenv};
-
FILE *of = fdopen(fd, "w");
ck_assert_ptr_nonnull(of);
int count = fwrite(&data, sizeof(BG_ENVDATA), 1, of);
@@ -86,8 +83,10 @@ START_TEST(bgenv_get_from_manipulated)
memset(out, 0, sizeof(out));
/* must not crash */
ebg_env_get(&e, key, out);
+ /* silences cppcheck nullPointerRedundantCheck over ck_assert_str_eq */
+ const char *empty_str = "";
/* ensure we did not read invalid data */
- ck_assert_str_eq(out, "");
+ ck_assert_str_eq(out, empty_str);
/* assert that get_env reports an error */
ck_assert_int_eq(result, false);
--
2.35.3
--
You received this message because you are subscribed to the Google Groups "EFI
Boot Guard" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/efibootguard-dev/038a3b1c-7bc0-4624-a952-6abbc5a1a475%40siemens.com.