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: Hailiang Wang <hailiangx.e.wang@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/460094
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
This commit is contained in:
Hailiang Wang 2019-07-02 15:06:12 +08:00 committed by Changpeng Liu
parent c3f051f832
commit 9c3774681b

View File

@ -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);
}