]> www.infradead.org Git - users/sagi/libnvme.git/commitdiff
test: mi: Explicitly zero args for test API invocations
authorJeremy Kerr <jk@codeconstruct.com.au>
Thu, 26 Jan 2023 02:24:54 +0000 (10:24 +0800)
committerJeremy Kerr <jk@codeconstruct.com.au>
Thu, 26 Jan 2023 02:24:54 +0000 (10:24 +0800)
We have a few places where we're passing an uninitialised pointer
argument to the libnvme API in the MI tests. Add an explicit zero init
for these.

Fixes: https://github.com/linux-nvme/libnvme/issues/563
Reported-by: Daniel Wagner <dwagner@suse.de>
Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
test/mi.c

index d945bed8994daf56db2f441dcfca68bd0345e1e8..f700b7a49d4a88e10bbb21164d9bfcc1590e2320 100644 (file)
--- a/test/mi.c
+++ b/test/mi.c
@@ -996,7 +996,7 @@ static int test_admin_set_features_cb(struct nvme_mi_ep *ep,
 static void test_set_features(nvme_mi_ep_t ep)
 {
        struct nvme_set_features_args args = { 0 };
-       struct nvme_timestamp tstamp;
+       struct nvme_timestamp tstamp = { 0 };
        nvme_mi_ctrl_t ctrl;
        uint32_t res;
        int rc, i;
@@ -1339,7 +1339,7 @@ static int test_admin_ns_mgmt_cb(struct nvme_mi_ep *ep,
 
 static void test_admin_ns_mgmt_create(struct nvme_mi_ep *ep)
 {
-       struct nvme_id_ns nsid;
+       struct nvme_id_ns nsid = { 0 };
        nvme_mi_ctrl_t ctrl;
        __u32 ns;
        int rc;
@@ -1828,8 +1828,8 @@ static int test_admin_get_log_split_cb(struct nvme_mi_ep *ep,
 
 static void test_admin_get_log_split(struct nvme_mi_ep *ep)
 {
+       struct nvme_get_log_args args = { 0 };
        unsigned char buf[4096 * 2 + 4];
-       struct nvme_get_log_args args;
        struct log_data ldata;
        nvme_mi_ctrl_t ctrl;
        int rc;