test: fix error about unittest_nvmf uninitialised parameters

When running unittest_nvmf in fedora29 with memcheck, there are
many errors about "Conditional jump or move depends on uninitialised
value(s)". The failed tests are:
in ctrlr_ut:
  test_reservation_notification_log_page
  fused_compare_and_write
in ctrlr_bdev_ut:
  spdk_nvmf_bdev_ctrlr_compare_and_write_cmd

Signed-off-by: Richael Zhuang <richael.zhuang@arm.com>
Change-Id: Ib1e6a744e86876c15ee53206909364e853574dd1
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/965
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Richael Zhuang 2020-02-20 14:55:41 +08:00 committed by Tomasz Zawadzki
parent 157b1a339a
commit 5e1b30bd28
2 changed files with 29 additions and 29 deletions

View File

@ -1171,9 +1171,9 @@ test_reservation_notification_log_page(void)
struct spdk_nvmf_qpair qpair;
struct spdk_nvmf_ns ns;
struct spdk_nvmf_request req;
union nvmf_h2c_msg cmd;
union nvmf_c2h_msg rsp = {{0}};
union spdk_nvme_async_event_completion event = {0};
union nvmf_h2c_msg cmd = {};
union nvmf_c2h_msg rsp = {};
union spdk_nvme_async_event_completion event = {};
struct spdk_nvme_reservation_notification_log logs[3];
memset(&ctrlr, 0, sizeof(ctrlr));
@ -1404,19 +1404,19 @@ test_custom_admin_cmd(void)
static void
test_fused_compare_and_write(void)
{
struct spdk_nvmf_request req;
struct spdk_nvmf_qpair qpair;
struct spdk_nvme_cmd cmd;
union nvmf_c2h_msg rsp;
struct spdk_nvmf_ctrlr ctrlr;
struct spdk_nvmf_subsystem subsystem;
struct spdk_nvmf_ns ns;
struct spdk_nvmf_ns *subsys_ns[1];
struct spdk_bdev bdev;
struct spdk_nvmf_request req = {};
struct spdk_nvmf_qpair qpair = {};
struct spdk_nvme_cmd cmd = {};
union nvmf_c2h_msg rsp = {};
struct spdk_nvmf_ctrlr ctrlr = {};
struct spdk_nvmf_subsystem subsystem = {};
struct spdk_nvmf_ns ns = {};
struct spdk_nvmf_ns *subsys_ns[1] = {};
struct spdk_bdev bdev = {};
struct spdk_nvmf_poll_group group;
struct spdk_nvmf_subsystem_poll_group sgroups;
struct spdk_nvmf_subsystem_pg_ns_info ns_info;
struct spdk_nvmf_poll_group group = {};
struct spdk_nvmf_subsystem_poll_group sgroups = {};
struct spdk_nvmf_subsystem_pg_ns_info ns_info = {};
ns.bdev = &bdev;

View File

@ -269,25 +269,25 @@ test_spdk_nvmf_bdev_ctrlr_compare_and_write_cmd(void)
struct spdk_bdev_desc *desc = NULL;
struct spdk_io_channel ch = {};
struct spdk_nvmf_request cmp_req;
union nvmf_c2h_msg cmp_rsp;
struct spdk_nvmf_request cmp_req = {};
union nvmf_c2h_msg cmp_rsp = {};
struct spdk_nvmf_request write_req;
union nvmf_c2h_msg write_rsp;
struct spdk_nvmf_request write_req = {};
union nvmf_c2h_msg write_rsp = {};
struct spdk_nvmf_qpair qpair;
struct spdk_nvmf_qpair qpair = {};
struct spdk_nvme_cmd cmp_cmd;
struct spdk_nvme_cmd write_cmd;
struct spdk_nvme_cmd cmp_cmd = {};
struct spdk_nvme_cmd write_cmd = {};
struct spdk_nvmf_ctrlr ctrlr;
struct spdk_nvmf_subsystem subsystem;
struct spdk_nvmf_ns ns;
struct spdk_nvmf_ns *subsys_ns[1];
struct spdk_nvmf_ctrlr ctrlr = {};
struct spdk_nvmf_subsystem subsystem = {};
struct spdk_nvmf_ns ns = {};
struct spdk_nvmf_ns *subsys_ns[1] = {};
struct spdk_nvmf_poll_group group;
struct spdk_nvmf_subsystem_poll_group sgroups;
struct spdk_nvmf_subsystem_pg_ns_info ns_info;
struct spdk_nvmf_poll_group group = {};
struct spdk_nvmf_subsystem_poll_group sgroups = {};
struct spdk_nvmf_subsystem_pg_ns_info ns_info = {};
bdev.blocklen = 512;
bdev.num_blocks = 10;