Commit 9c377468 authored by Hailiang Wang's avatar Hailiang Wang Committed by Changpeng Liu
Browse files

test/bdev_raid_ut: fix a warning of a null pointer dereference



Compilation Warning on fedora30.
bdev_raid_ut.c:659:13: warning: Array access
(via field 'base_channel') results in a null pointer dereference
CU_ASSERT(ch_ctx->base_channel[index] == g_io_output[index].ch);
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~
bdev_raid_ut.c:2181:14: warning: Array access
(via field 'base_channel') results in a null pointer dereference
CU_ASSERT(ch_ctx->base_channel[j] == (void *)0x1);
      ^~~~~~~~~~~~~~~~~~~~~~~
This is related to issue #822.

Change-Id: I9fd066b16e9f4c1fedc95403d2ac6e609f862c65
Signed-off-by: default avatarHailiang Wang <hailiangx.e.wang@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/460094


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
parent c3f051f8
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -653,6 +653,7 @@ verify_reset_io(struct spdk_bdev_io *bdev_io, uint8_t num_base_drives,
	SPDK_CU_ASSERT_FATAL(raid_bdev != NULL);
	SPDK_CU_ASSERT_FATAL(num_base_drives != 0);
	SPDK_CU_ASSERT_FATAL(io_status != INVALID_IO_SUBMIT);
	SPDK_CU_ASSERT_FATAL(ch_ctx->base_channel != NULL);

	CU_ASSERT(g_io_output_index == num_base_drives);
	for (index = 0; index < g_io_output_index; index++) {
@@ -2176,7 +2177,7 @@ test_multi_raid_with_io(void)
		ch_ctx = spdk_io_channel_get_ctx(&ch[i]);
		SPDK_CU_ASSERT_FATAL(ch_ctx != NULL);
		CU_ASSERT(raid_bdev_create_cb(pbdev, ch_ctx) == 0);
		CU_ASSERT(ch_ctx->base_channel != NULL);
		SPDK_CU_ASSERT_FATAL(ch_ctx->base_channel != NULL);
		for (j = 0; j < construct_req[i].base_bdevs.num_base_bdevs; j++) {
			CU_ASSERT(ch_ctx->base_channel[j] == (void *)0x1);
		}