From 438b71d17ebaee1e2d53f4548e6cf91ef1623ce2 Mon Sep 17 00:00:00 2001 From: Seth Howell Date: Wed, 29 Aug 2018 11:48:12 -0700 Subject: [PATCH] test/unit: fix scan-build errors in blobfs tests fix 3 null pointer dereferences. Change-Id: I0f11b8e47b05d0e965cea75d7b064cc2c11645e3 Signed-off-by: Seth Howell Reviewed-on: https://review.gerrithub.io/423942 Tested-by: SPDK CI Jenkins Reviewed-by: Jim Harris Reviewed-by: Ben Walker --- test/unit/lib/blobfs/blobfs_async_ut/blobfs_async_ut.c | 4 ++-- test/unit/lib/blobfs/blobfs_sync_ut/blobfs_sync_ut.c | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/test/unit/lib/blobfs/blobfs_async_ut/blobfs_async_ut.c b/test/unit/lib/blobfs/blobfs_async_ut/blobfs_async_ut.c index 693edef29..baf4bc7f5 100644 --- a/test/unit/lib/blobfs/blobfs_async_ut/blobfs_async_ut.c +++ b/test/unit/lib/blobfs/blobfs_async_ut/blobfs_async_ut.c @@ -90,7 +90,7 @@ fs_init(void) spdk_allocate_thread(_fs_send_msg, NULL, NULL, NULL, "thread0"); spdk_fs_init(dev, NULL, NULL, fs_op_with_handle_complete, NULL); - CU_ASSERT(g_fs != NULL); + SPDK_CU_ASSERT_FATAL(g_fs != NULL); CU_ASSERT(g_fserrno == 0); fs = g_fs; @@ -134,7 +134,7 @@ fs_open(void) spdk_allocate_thread(_fs_send_msg, NULL, NULL, NULL, "thread0"); spdk_fs_init(dev, NULL, NULL, fs_op_with_handle_complete, NULL); - CU_ASSERT(g_fs != NULL); + SPDK_CU_ASSERT_FATAL(g_fs != NULL); CU_ASSERT(g_fserrno == 0); fs = g_fs; diff --git a/test/unit/lib/blobfs/blobfs_sync_ut/blobfs_sync_ut.c b/test/unit/lib/blobfs/blobfs_sync_ut/blobfs_sync_ut.c index b7f9261e3..140d99bd0 100644 --- a/test/unit/lib/blobfs/blobfs_sync_ut/blobfs_sync_ut.c +++ b/test/unit/lib/blobfs/blobfs_sync_ut/blobfs_sync_ut.c @@ -317,6 +317,7 @@ fs_delete_file_without_close(void) rc = spdk_fs_open_file(g_fs, channel, "testfile", SPDK_BLOBFS_OPEN_CREATE, &g_file); CU_ASSERT(rc == 0); + SPDK_CU_ASSERT_FATAL(g_file != NULL); rc = spdk_fs_delete_file(g_fs, channel, "testfile"); CU_ASSERT(rc == 0);