From df8cbd66c725fa1466f5cd35231c0f96d6d1e4a3 Mon Sep 17 00:00:00 2001 From: Seth Howell Date: Fri, 6 Jul 2018 16:14:25 -0700 Subject: [PATCH] test/unit: remove more scan-build errors Change-Id: Ia0f304c20d736cebd43b29337e7c6f8918cff7ef Signed-off-by: Seth Howell Reviewed-on: https://review.gerrithub.io/418235 Tested-by: SPDK Automated Test System Reviewed-by: Daniel Verkamp Reviewed-by: Ben Walker --- test/unit/lib/iscsi/iscsi.c/iscsi_ut.c | 2 +- .../lib/iscsi/portal_grp.c/portal_grp_ut.c | 18 ++++++++++++------ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/test/unit/lib/iscsi/iscsi.c/iscsi_ut.c b/test/unit/lib/iscsi/iscsi.c/iscsi_ut.c index 5217430379..c6714af445 100644 --- a/test/unit/lib/iscsi/iscsi.c/iscsi_ut.c +++ b/test/unit/lib/iscsi/iscsi.c/iscsi_ut.c @@ -224,7 +224,7 @@ maxburstlength_test(void) rc = spdk_iscsi_execute(&conn, data_out_pdu); CU_ASSERT(rc == SPDK_ISCSI_CONNECTION_FATAL); - CU_ASSERT(response_pdu->task != NULL); + SPDK_CU_ASSERT_FATAL(response_pdu->task != NULL); spdk_iscsi_task_disassociate_pdu(response_pdu->task); spdk_iscsi_task_put(response_pdu->task); spdk_put_pdu(response_pdu); diff --git a/test/unit/lib/iscsi/portal_grp.c/portal_grp_ut.c b/test/unit/lib/iscsi/portal_grp.c/portal_grp_ut.c index 9f2b6915fc..77351f0ac3 100644 --- a/test/unit/lib/iscsi/portal_grp.c/portal_grp_ut.c +++ b/test/unit/lib/iscsi/portal_grp.c/portal_grp_ut.c @@ -170,7 +170,7 @@ parse_portal_ipv4_normal_case(void) const char *host_str = "192.168.2.0"; const char *port_str = "3260"; struct spdk_cpuset *cpumask_val; - struct spdk_iscsi_portal *p; + struct spdk_iscsi_portal *p = NULL; int rc; cpumask_val = spdk_cpuset_alloc(); @@ -180,6 +180,7 @@ parse_portal_ipv4_normal_case(void) rc = spdk_iscsi_parse_portal(string, &p, 0); CU_ASSERT(rc == 0); + SPDK_CU_ASSERT_FATAL(p != NULL); CU_ASSERT(strcmp(p->host, host_str) == 0); CU_ASSERT(strcmp(p->port, port_str) == 0); CU_ASSERT(spdk_cpuset_equal(p->cpumask, cpumask_val)); @@ -197,7 +198,7 @@ parse_portal_ipv6_normal_case(void) const char *host_str = "[2001:ad6:1234::]"; const char *port_str = "3260"; struct spdk_cpuset *cpumask_val; - struct spdk_iscsi_portal *p; + struct spdk_iscsi_portal *p = NULL; int rc; cpumask_val = spdk_cpuset_alloc(); @@ -207,6 +208,7 @@ parse_portal_ipv6_normal_case(void) rc = spdk_iscsi_parse_portal(string, &p, 0); CU_ASSERT(rc == 0); + SPDK_CU_ASSERT_FATAL(p != NULL); CU_ASSERT(strcmp(p->host, host_str) == 0); CU_ASSERT(strcmp(p->port, port_str) == 0); CU_ASSERT(spdk_cpuset_equal(p->cpumask, cpumask_val)); @@ -224,13 +226,14 @@ parse_portal_ipv4_skip_cpumask_case(void) const char *host_str = "192.168.2.0"; const char *port_str = "3260"; struct spdk_cpuset *cpumask_val; - struct spdk_iscsi_portal *p; + struct spdk_iscsi_portal *p = NULL; int rc; cpumask_val = spdk_app_get_core_mask(); rc = spdk_iscsi_parse_portal(string, &p, 0); CU_ASSERT(rc == 0); + SPDK_CU_ASSERT_FATAL(p != NULL); CU_ASSERT(strcmp(p->host, host_str) == 0); CU_ASSERT(strcmp(p->port, port_str) == 0); CU_ASSERT(spdk_cpuset_equal(p->cpumask, cpumask_val)); @@ -246,13 +249,14 @@ parse_portal_ipv6_skip_cpumask_case(void) const char *host_str = "[2001:ad6:1234::]"; const char *port_str = "3260"; struct spdk_cpuset *cpumask_val; - struct spdk_iscsi_portal *p; + struct spdk_iscsi_portal *p = NULL; int rc; cpumask_val = spdk_app_get_core_mask(); rc = spdk_iscsi_parse_portal(string, &p, 0); CU_ASSERT(rc == 0); + SPDK_CU_ASSERT_FATAL(p != NULL); CU_ASSERT(strcmp(p->host, host_str) == 0); CU_ASSERT(strcmp(p->port, port_str) == 0); CU_ASSERT(spdk_cpuset_equal(p->cpumask, cpumask_val)); @@ -268,13 +272,14 @@ parse_portal_ipv4_skip_port_and_cpumask_case(void) const char *host_str = "192.168.2.0"; const char *port_str = "3260"; struct spdk_cpuset *cpumask_val; - struct spdk_iscsi_portal *p; + struct spdk_iscsi_portal *p = NULL; int rc; cpumask_val = spdk_app_get_core_mask(); rc = spdk_iscsi_parse_portal(string, &p, 0); CU_ASSERT(rc == 0); + SPDK_CU_ASSERT_FATAL(p != NULL); CU_ASSERT(strcmp(p->host, host_str) == 0); CU_ASSERT(strcmp(p->port, port_str) == 0); CU_ASSERT(spdk_cpuset_equal(p->cpumask, cpumask_val)); @@ -290,13 +295,14 @@ parse_portal_ipv6_skip_port_and_cpumask_case(void) const char *host_str = "[2001:ad6:1234::]"; const char *port_str = "3260"; struct spdk_cpuset *cpumask_val; - struct spdk_iscsi_portal *p; + struct spdk_iscsi_portal *p = NULL; int rc; cpumask_val = spdk_app_get_core_mask(); rc = spdk_iscsi_parse_portal(string, &p, 0); CU_ASSERT(rc == 0); + SPDK_CU_ASSERT_FATAL(p != NULL); CU_ASSERT(strcmp(p->host, host_str) == 0); CU_ASSERT(strcmp(p->port, port_str) == 0); CU_ASSERT(spdk_cpuset_equal(p->cpumask, cpumask_val));