test/unit: fix Scan-build errors in lvol tests.
Fixes two null pointer dereference errors. Change-Id: I7d685fa54af60e6efd70f3686d4dc4dba338f555 Signed-off-by: Seth Howell <seth.howell@intel.com> Reviewed-on: https://review.gerrithub.io/424108 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
2e6aac525c
commit
84009795c5
@ -1051,6 +1051,7 @@ spdk_lvol_create(struct spdk_lvol_store *lvs, const char *name, uint64_t sz,
|
||||
return rc;
|
||||
}
|
||||
|
||||
assert(lvs != NULL);
|
||||
bs = lvs->blobstore;
|
||||
|
||||
req = calloc(1, sizeof(*req));
|
||||
|
@ -1851,6 +1851,7 @@ static void lvol_refcnt(void)
|
||||
{
|
||||
struct lvol_ut_bs_dev dev;
|
||||
struct spdk_lvs_opts opts;
|
||||
struct spdk_lvol *lvol;
|
||||
int rc = 0;
|
||||
|
||||
init_dev(&dev);
|
||||
@ -1872,24 +1873,26 @@ static void lvol_refcnt(void)
|
||||
SPDK_CU_ASSERT_FATAL(g_lvol != NULL);
|
||||
CU_ASSERT(g_lvol->ref_count == 1);
|
||||
|
||||
lvol = g_lvol;
|
||||
spdk_lvol_open(g_lvol, lvol_op_with_handle_complete, NULL);
|
||||
CU_ASSERT(g_lvol->ref_count == 2);
|
||||
SPDK_CU_ASSERT_FATAL(g_lvol != NULL);
|
||||
CU_ASSERT(lvol->ref_count == 2);
|
||||
|
||||
/* Trying to destroy lvol while its open should fail */
|
||||
spdk_lvol_destroy(g_lvol, lvol_op_complete, NULL);
|
||||
spdk_lvol_destroy(lvol, lvol_op_complete, NULL);
|
||||
CU_ASSERT(g_lvolerrno != 0);
|
||||
|
||||
spdk_lvol_close(g_lvol, lvol_op_complete, NULL);
|
||||
CU_ASSERT(g_lvol->ref_count == 1);
|
||||
spdk_lvol_close(lvol, lvol_op_complete, NULL);
|
||||
CU_ASSERT(lvol->ref_count == 1);
|
||||
CU_ASSERT(g_lvolerrno == 0);
|
||||
|
||||
spdk_lvol_close(g_lvol, lvol_op_complete, NULL);
|
||||
CU_ASSERT(g_lvol->ref_count == 0);
|
||||
spdk_lvol_close(lvol, lvol_op_complete, NULL);
|
||||
CU_ASSERT(lvol->ref_count == 0);
|
||||
CU_ASSERT(g_lvolerrno == 0);
|
||||
|
||||
/* Try to close already closed lvol */
|
||||
spdk_lvol_close(g_lvol, lvol_op_complete, NULL);
|
||||
CU_ASSERT(g_lvol->ref_count == 0);
|
||||
spdk_lvol_close(lvol, lvol_op_complete, NULL);
|
||||
CU_ASSERT(lvol->ref_count == 0);
|
||||
CU_ASSERT(g_lvolerrno != 0);
|
||||
|
||||
g_lvserrno = -1;
|
||||
|
Loading…
Reference in New Issue
Block a user