From c0297f9c710491836566bf5a28c55c45360b4a95 Mon Sep 17 00:00:00 2001 From: Seth Howell Date: Thu, 30 Aug 2018 11:23:27 -0700 Subject: [PATCH] test/unit: Fix scan-build errors in thread and util tests thread_ut.c: ensure that the channel context is non-null util: get rid of a couple of uninitialized value errors. Change-Id: Idbaad4efea14acd7ae8f98b60aa514e45213a134 Signed-off-by: Seth Howell Reviewed-on: https://review.gerrithub.io/424124 Tested-by: SPDK CI Jenkins Chandler-Test-Pool: SPDK Automated Test System Reviewed-by: Shuhei Matsumoto Reviewed-by: Ben Walker Reviewed-by: Jim Harris --- test/unit/lib/thread/thread.c/thread_ut.c | 1 + test/unit/lib/util/base64.c/base64_ut.c | 2 +- test/unit/lib/util/string.c/string_ut.c | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/test/unit/lib/thread/thread.c/thread_ut.c b/test/unit/lib/thread/thread.c/thread_ut.c index caebe348d..c53302e83 100644 --- a/test/unit/lib/thread/thread.c/thread_ut.c +++ b/test/unit/lib/thread/thread.c/thread_ut.c @@ -280,6 +280,7 @@ unreg_ch_done(struct spdk_io_channel_iter *i) ctx->ch_done = true; + SPDK_CU_ASSERT_FATAL(i->cur_thread != NULL); spdk_for_each_channel_continue(i, 0); } diff --git a/test/unit/lib/util/base64.c/base64_ut.c b/test/unit/lib/util/base64.c/base64_ut.c index 0f537132a..652a1e94c 100644 --- a/test/unit/lib/util/base64.c/base64_ut.c +++ b/test/unit/lib/util/base64.c/base64_ut.c @@ -192,7 +192,7 @@ test_base64_urlsafe_decode(void) { char raw_buf[100]; void *raw = (void *)raw_buf; - size_t raw_len; + size_t raw_len = 0; int ret; ret = spdk_base64_urlsafe_decode(raw, &raw_len, text_A); diff --git a/test/unit/lib/util/string.c/string_ut.c b/test/unit/lib/util/string.c/string_ut.c index 104893879..2ca32cbe4 100644 --- a/test/unit/lib/util/string.c/string_ut.c +++ b/test/unit/lib/util/string.c/string_ut.c @@ -142,7 +142,7 @@ test_parse_capacity(void) char str[128]; uint64_t cap; int rc; - bool has_prefix; + bool has_prefix = true; rc = spdk_parse_capacity("472", &cap, &has_prefix); CU_ASSERT(rc == 0);