torture: Fix uninitialized variables
authorVolker Lendecke <vl@samba.org>
Wed, 19 Oct 2016 08:27:14 +0000 (10:27 +0200)
committerJeremy Allison <jra@samba.org>
Thu, 20 Oct 2016 00:48:30 +0000 (02:48 +0200)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Oct 20 02:48:30 CEST 2016 on sn-devel-144

source4/torture/smb2/acls.c
source4/torture/smb2/create.c
source4/torture/smb2/dir.c
source4/torture/smb2/durable_open.c
source4/torture/smb2/lease.c
source4/torture/smb2/lock.c
source4/torture/smb2/notify.c
source4/torture/smb2/streams.c
source4/torture/vfs/acl_xattr.c

index d4c575b9fa7f23c634006920f2c844f3733fbc3e..beb5abf8e8dc97c764189edd7ac5c513a722a0fb 100644 (file)
@@ -99,7 +99,7 @@ static bool test_creator_sid(struct torture_context *tctx, struct smb2_tree *tre
        struct smb2_create io;
        const char *fname = BASEDIR "\\creator.txt";
        bool ret = true;
-       struct smb2_handle handle;
+       struct smb2_handle handle = {{0}};
        union smb_fileinfo q;
        union smb_setfileinfo set;
        struct security_descriptor *sd, *sd_orig, *sd2;
@@ -301,7 +301,7 @@ static bool test_generic_bits(struct torture_context *tctx, struct smb2_tree *tr
        struct smb2_create io;
        const char *fname = BASEDIR "\\generic.txt";
        bool ret = true;
-       struct smb2_handle handle;
+       struct smb2_handle handle = {{0}};
        int i;
        union smb_fileinfo q;
        union smb_setfileinfo set;
@@ -667,7 +667,7 @@ static bool test_owner_bits(struct torture_context *tctx, struct smb2_tree *tree
        struct smb2_create io;
        const char *fname = BASEDIR "\\test_owner_bits.txt";
        bool ret = true;
-       struct smb2_handle handle;
+       struct smb2_handle handle = {{0}};
        int i;
        union smb_fileinfo q;
        union smb_setfileinfo set;
@@ -803,7 +803,8 @@ static bool test_inheritance(struct torture_context *tctx, struct smb2_tree *tre
        const char *fname1 = BASEDIR "\\inheritance\\testfile";
        const char *fname2 = BASEDIR "\\inheritance\\testdir";
        bool ret = true;
-       struct smb2_handle handle, handle2;
+       struct smb2_handle handle = {{0}};
+       struct smb2_handle handle2 = {{0}};
        int i;
        union smb_fileinfo q;
        union smb_setfileinfo set;
@@ -1278,7 +1279,8 @@ static bool test_inheritance_flags(struct torture_context *tctx,
        const char *dname = BASEDIR "\\inheritance";
        const char *fname1 = BASEDIR "\\inheritance\\testfile";
        bool ret = true;
-       struct smb2_handle handle, handle2;
+       struct smb2_handle handle = {{0}};
+       struct smb2_handle handle2 = {{0}};
        int i, j;
        union smb_fileinfo q;
        union smb_setfileinfo set;
@@ -1510,7 +1512,8 @@ static bool test_inheritance_dynamic(struct torture_context *tctx,
        const char *dname = BASEDIR "\\inheritance";
        const char *fname1 = BASEDIR "\\inheritance\\testfile";
        bool ret = true;
-       struct smb2_handle handle, handle2;
+       struct smb2_handle handle = {{0}};
+       struct smb2_handle handle2 = {{0}};
        union smb_fileinfo q;
        union smb_setfileinfo set;
        struct security_descriptor *sd, *sd_orig=NULL;
index 9b3840060263c4bbad0d5970a878d4d76eae929b..09a17be0c9f868bf86fc5780a60b30e29894087d 100644 (file)
@@ -706,7 +706,8 @@ static bool test_smb2_open(struct torture_context *tctx,
        const char *fname = DNAME "\\torture_ntcreatex.txt";
        const char *dname = DNAME "\\torture_ntcreatex.dir";
        NTSTATUS status;
-       struct smb2_handle h, h1;
+       struct smb2_handle h = {{0}};
+       struct smb2_handle h1 = {{0}};
        bool ret = true;
        int i;
        struct {
index 715e9846cf5c135876df2ec0b31be0528b858c72..2e5db9128aae26422430c5b708d83d2ac771cd1b 100644 (file)
@@ -203,7 +203,8 @@ static bool test_fixed(struct torture_context *tctx,
 {
        TALLOC_CTX *mem_ctx = talloc_new(tctx);
        struct smb2_create create;
-       struct smb2_handle h, h2;
+       struct smb2_handle h = {{0}};
+       struct smb2_handle h2 = {{0}};
        struct smb2_find f;
        union smb_search_data *d;
        struct file_elem files[NFILES] = {};
@@ -1265,7 +1266,7 @@ static bool test_large_files(struct torture_context *tctx,
        NTSTATUS status;
        struct smb2_create create;
        struct smb2_find f;
-       struct smb2_handle h;
+       struct smb2_handle h = {{0}};
        union smb_search_data *d;
        int i, j, file_count = 0;
        char **strs = NULL;
index 7b595667db977e2f3b00887ff9a2f20c3ffdb17a..2e68170077ab90129b10f2fbd59967df63b62462 100644 (file)
@@ -1918,7 +1918,8 @@ static bool test_durable_open_oplock(struct torture_context *tctx,
 {
        TALLOC_CTX *mem_ctx = talloc_new(tctx);
        struct smb2_create io1, io2;
-       struct smb2_handle h1, h2;
+       struct smb2_handle h1 = {{0}};
+       struct smb2_handle h2 = {{0}};
        NTSTATUS status;
        char fname[256];
        bool ret = true;
@@ -1993,7 +1994,8 @@ static bool test_durable_open_lease(struct torture_context *tctx,
        TALLOC_CTX *mem_ctx = talloc_new(tctx);
        struct smb2_create io1, io2;
        struct smb2_lease ls1, ls2;
-       struct smb2_handle h1, h2;
+       struct smb2_handle h1 = {{0}};
+       struct smb2_handle h2 = {{0}};
        NTSTATUS status;
        char fname[256];
        bool ret = true;
@@ -2092,7 +2094,7 @@ static bool test_durable_open_lock_oplock(struct torture_context *tctx,
 {
        TALLOC_CTX *mem_ctx = talloc_new(tctx);
        struct smb2_create io;
-       struct smb2_handle h;
+       struct smb2_handle h = {{0}};
        struct smb2_lock lck;
        struct smb2_lock_element el[2];
        NTSTATUS status;
@@ -2174,7 +2176,7 @@ static bool test_durable_open_lock_lease(struct torture_context *tctx,
        TALLOC_CTX *mem_ctx = talloc_new(tctx);
        struct smb2_create io;
        struct smb2_lease ls;
-       struct smb2_handle h;
+       struct smb2_handle h = {{0}};
        struct smb2_lock lck;
        struct smb2_lock_element el[2];
        NTSTATUS status;
@@ -2279,7 +2281,8 @@ static bool test_durable_open_open2_lease(struct torture_context *tctx,
        TALLOC_CTX *mem_ctx = talloc_new(tctx);
        struct smb2_create io1, io2;
        struct smb2_lease ls;
-       struct smb2_handle h1, h2;
+       struct smb2_handle h1 = {{0}};
+       struct smb2_handle h2 = {{0}};
        NTSTATUS status;
        char fname[256];
        bool ret = true;
@@ -2385,7 +2388,8 @@ static bool test_durable_open_open2_oplock(struct torture_context *tctx,
 {
        TALLOC_CTX *mem_ctx = talloc_new(tctx);
        struct smb2_create io1, io2;
-       struct smb2_handle h1, h2;
+       struct smb2_handle h1 = {{0}};
+       struct smb2_handle h2 = {{0}};
        NTSTATUS status;
        char fname[256];
        bool ret = true;
index 6a2e88b0d00700d7a0d2fd1a28757d8ac4642b69..3ee915cc9522a0f605defbc96f4055b6823a84a4 100644 (file)
@@ -121,7 +121,8 @@ static bool test_lease_request(struct torture_context *tctx,
        TALLOC_CTX *mem_ctx = talloc_new(tctx);
        struct smb2_create io;
        struct smb2_lease ls;
-       struct smb2_handle h1, h2;
+       struct smb2_handle h1 = {{0}};
+       struct smb2_handle h2 = {{0}};
        NTSTATUS status;
        const char *fname = "lease_request.dat";
        const char *fname2 = "lease_request.2.dat";
@@ -209,7 +210,8 @@ static bool test_lease_upgrade(struct torture_context *tctx,
        TALLOC_CTX *mem_ctx = talloc_new(tctx);
        struct smb2_create io;
        struct smb2_lease ls;
-       struct smb2_handle h, hnew;
+       struct smb2_handle h = {{0}};
+       struct smb2_handle hnew = {{0}};
        NTSTATUS status;
        const char *fname = "lease_upgrade.dat";
        bool ret = true;
@@ -840,7 +842,8 @@ static bool test_lease_nobreakself(struct torture_context *tctx,
        TALLOC_CTX *mem_ctx = talloc_new(tctx);
        struct smb2_create io;
        struct smb2_lease ls;
-       struct smb2_handle h1, h2;
+       struct smb2_handle h1 = {{0}};
+       struct smb2_handle h2 = {{0}};
        NTSTATUS status;
        const char *fname = "lease_nobreakself.dat";
        bool ret = true;
@@ -919,7 +922,8 @@ static bool test_lease_statopen(struct torture_context *tctx,
        TALLOC_CTX *mem_ctx = talloc_new(tctx);
        struct smb2_create io;
        struct smb2_lease ls;
-       struct smb2_handle h1, h2;
+       struct smb2_handle h1 = {{0}};
+       struct smb2_handle h2 = {{0}};
        NTSTATUS status;
        const char *fname = "lease_statopen.dat";
        bool ret = true;
@@ -1192,7 +1196,9 @@ static bool test_lease_multibreak(struct torture_context *tctx,
        TALLOC_CTX *mem_ctx = talloc_new(tctx);
        struct smb2_create io;
        struct smb2_lease ls;
-       struct smb2_handle h, h2, h3;
+       struct smb2_handle h = {{0}};
+       struct smb2_handle h2 = {{0}};
+       struct smb2_handle h3 = {{0}};
        struct smb2_write w;
        NTSTATUS status;
        const char *fname = "lease_multibreak.dat";
@@ -1311,7 +1317,7 @@ static bool test_lease_v2_request_parent(struct torture_context *tctx,
        TALLOC_CTX *mem_ctx = talloc_new(tctx);
        struct smb2_create io;
        struct smb2_lease ls;
-       struct smb2_handle h1;
+       struct smb2_handle h1 = {{0}};
        uint64_t parent = LEASE2;
        NTSTATUS status;
        const char *fname = "lease_v2_request_parent.dat";
@@ -1367,7 +1373,7 @@ static bool test_lease_break_twice(struct torture_context *tctx,
        struct smb2_create io;
        struct smb2_lease ls1;
        struct smb2_lease ls2;
-       struct smb2_handle h1;
+       struct smb2_handle h1 = {{0}};
        NTSTATUS status;
        const char *fname = "lease_break_twice.dat";
        bool ret = true;
@@ -1439,7 +1445,11 @@ static bool test_lease_v2_request(struct torture_context *tctx,
        TALLOC_CTX *mem_ctx = talloc_new(tctx);
        struct smb2_create io;
        struct smb2_lease ls1, ls2, ls2t, ls3, ls4;
-       struct smb2_handle h1, h2, h3, h4, h5;
+       struct smb2_handle h1 = {{0}};
+       struct smb2_handle h2 = {{0}};
+       struct smb2_handle h3 = {{0}};
+       struct smb2_handle h4 = {{0}};
+       struct smb2_handle h5 = {{0}};
        struct smb2_write w;
        NTSTATUS status;
        const char *fname = "lease_v2_request.dat";
@@ -3060,7 +3070,9 @@ static bool test_lease_complex1(struct torture_context *tctx,
        struct smb2_create io2;
        struct smb2_lease ls1;
        struct smb2_lease ls2;
-       struct smb2_handle h, h2, h3;
+       struct smb2_handle h = {{0}};
+       struct smb2_handle h2 = {{0}};
+       struct smb2_handle h3 = {{0}};
        struct smb2_write w;
        NTSTATUS status;
        const char *fname = "lease_complex1.dat";
@@ -3186,7 +3198,9 @@ static bool test_lease_v2_complex1(struct torture_context *tctx,
        struct smb2_create io2;
        struct smb2_lease ls1;
        struct smb2_lease ls2;
-       struct smb2_handle h, h2, h3;
+       struct smb2_handle h = {{0}};
+       struct smb2_handle h2 = {{0}};
+       struct smb2_handle h3 = {{0}};
        struct smb2_write w;
        NTSTATUS status;
        const char *fname = "lease_v2_complex1.dat";
@@ -3331,7 +3345,8 @@ static bool test_lease_v2_complex2(struct torture_context *tctx,
        struct smb2_create io2;
        struct smb2_lease ls1;
        struct smb2_lease ls2;
-       struct smb2_handle h, h2;
+       struct smb2_handle h = {{0}};
+       struct smb2_handle h2 = {{0}};
        struct smb2_request *req2 = NULL;
        struct smb2_lease_break_ack ack = {};
        NTSTATUS status;
@@ -3440,7 +3455,9 @@ static bool test_lease_timeout(struct torture_context *tctx,
        struct smb2_create io;
        struct smb2_lease ls1;
        struct smb2_lease ls2;
-       struct smb2_handle h, hnew, h1b;
+       struct smb2_handle h = {{0}};
+       struct smb2_handle hnew = {{0}};
+       struct smb2_handle h1b = {{0}};
        NTSTATUS status;
        const char *fname = "lease_timeout.dat";
        bool ret = true;
@@ -3568,7 +3585,9 @@ static bool test_lease_v2_rename(struct torture_context *tctx,
        struct smb2_create io;
        struct smb2_lease ls1;
        struct smb2_lease ls2;
-       struct smb2_handle h, h1, h2;
+       struct smb2_handle h = {{0}};
+       struct smb2_handle h1 = {{0}};
+       struct smb2_handle h2 = {{0}};
        union smb_setfileinfo sinfo;
        const char *fname = "lease_v2_rename_src.dat";
        const char *fname_dst = "lease_v2_rename_dst.dat";
index 3900abf50ad0657ce18a7771e6a0c2cfd9b6d510..ff422113caa73c80602c291f1604ee9feba7f67d 100644 (file)
@@ -587,7 +587,8 @@ static bool test_lock(struct torture_context *torture,
 {
        NTSTATUS status;
        bool ret = true;
-       struct smb2_handle h, h2;
+       struct smb2_handle h = {{0}};
+       struct smb2_handle h2 = {{0}};
        uint8_t buf[200];
        struct smb2_lock lck;
        struct smb2_lock_element el[2];
@@ -799,7 +800,8 @@ static bool test_async(struct torture_context *torture,
 {
        NTSTATUS status;
        bool ret = true;
-       struct smb2_handle h, h2;
+       struct smb2_handle h = {{0}};
+       struct smb2_handle h2 = {{0}};
        uint8_t buf[200];
        struct smb2_lock lck;
        struct smb2_lock_element el[2];
@@ -867,7 +869,8 @@ static bool test_cancel(struct torture_context *torture,
 {
        NTSTATUS status;
        bool ret = true;
-       struct smb2_handle h, h2;
+       struct smb2_handle h = {{0}};
+       struct smb2_handle h2 = {{0}};
        uint8_t buf[200];
        struct smb2_lock lck;
        struct smb2_lock_element el[2];
@@ -995,7 +998,8 @@ static bool test_cancel_tdis(struct torture_context *torture,
 {
        NTSTATUS status;
        bool ret = true;
-       struct smb2_handle h, h2;
+       struct smb2_handle h = {{0}};
+       struct smb2_handle h2 = {{0}};
        uint8_t buf[200];
        struct smb2_lock lck;
        struct smb2_lock_element el[2];
@@ -1089,7 +1093,8 @@ static bool test_cancel_logoff(struct torture_context *torture,
 {
        NTSTATUS status;
        bool ret = true;
-       struct smb2_handle h, h2;
+       struct smb2_handle h = {{0}};
+       struct smb2_handle h2 = {{0}};
        uint8_t buf[200];
        struct smb2_lock lck;
        struct smb2_lock_element el[2];
@@ -1185,7 +1190,8 @@ static bool test_errorcode(struct torture_context *torture,
 {
        NTSTATUS status;
        bool ret = true;
-       struct smb2_handle h, h2;
+       struct smb2_handle h = {{0}};
+       struct smb2_handle h2 = {{0}};
        uint8_t buf[200];
        struct smb2_lock lck;
        struct smb2_lock_element el[2];
@@ -1348,7 +1354,8 @@ static bool test_zerobytelength(struct torture_context *torture,
 {
        NTSTATUS status;
        bool ret = true;
-       struct smb2_handle h, h2;
+       struct smb2_handle h = {{0}};
+       struct smb2_handle h2 = {{0}};
        uint8_t buf[200];
        struct smb2_lock lck;
        int i;
@@ -1467,7 +1474,8 @@ static bool test_zerobyteread(struct torture_context *torture,
 {
        NTSTATUS status;
        bool ret = true;
-       struct smb2_handle h, h2;
+       struct smb2_handle h = {{0}};
+       struct smb2_handle h2 = {{0}};
        uint8_t buf[200];
        struct smb2_lock lck;
        struct smb2_lock_element el[1];
@@ -1585,7 +1593,8 @@ static bool test_unlock(struct torture_context *torture,
 {
        NTSTATUS status;
        bool ret = true;
-       struct smb2_handle h, h2;
+       struct smb2_handle h = {{0}};
+       struct smb2_handle h2 = {{0}};
        uint8_t buf[200];
        struct smb2_lock lck;
        struct smb2_lock_element el1[1];
@@ -2136,7 +2145,8 @@ static bool test_stacking(struct torture_context *torture,
 {
        NTSTATUS status;
        bool ret = true;
-       struct smb2_handle h, h2;
+       struct smb2_handle h = {{0}};
+       struct smb2_handle h2 = {{0}};
        uint8_t buf[200];
        struct smb2_lock lck;
        struct smb2_lock_element el[1];
@@ -2339,7 +2349,8 @@ static bool test_contend(struct torture_context *torture,
 {
        NTSTATUS status;
        bool ret = true;
-       struct smb2_handle h, h2;
+       struct smb2_handle h = {{0}};
+       struct smb2_handle h2 = {{0}};
        uint8_t buf[200];
        struct smb2_lock lck;
        struct smb2_lock_element el[1];
@@ -2408,7 +2419,8 @@ static bool test_context(struct torture_context *torture,
 {
        NTSTATUS status;
        bool ret = true;
-       struct smb2_handle h, h2;
+       struct smb2_handle h = {{0}};
+       struct smb2_handle h2 = {{0}};
        uint8_t buf[200];
        struct smb2_lock lck;
        struct smb2_lock_element el[1];
@@ -2474,7 +2486,8 @@ static bool test_range(struct torture_context *torture,
 {
        NTSTATUS status;
        bool ret = true;
-       struct smb2_handle h, h2;
+       struct smb2_handle h = {{0}};
+       struct smb2_handle h2 = {{0}};
        uint8_t buf[200];
        struct smb2_lock lck;
        struct smb2_lock_element el[1];
@@ -2675,7 +2688,9 @@ static bool test_overlap(struct torture_context *torture,
 {
        NTSTATUS status;
        bool ret = true;
-       struct smb2_handle h, h2, h3;
+       struct smb2_handle h = {{0}};
+       struct smb2_handle h2 = {{0}};
+       struct smb2_handle h3 = {{0}};
        uint8_t buf[200];
        bool correct = true;
 
@@ -2775,7 +2790,8 @@ static bool test_truncate(struct torture_context *torture,
 {
        NTSTATUS status;
        bool ret = true;
-       struct smb2_handle h, h2;
+       struct smb2_handle h = {{0}};
+       struct smb2_handle h2 = {{0}};
        uint8_t buf[200];
        struct smb2_lock lck;
        struct smb2_lock_element el[1];
index d9b0f593e32b2e815a22a53a331af76f4b7b3a51..90f5ad9a6337ffe691020eb7e90c827c7caa726c 100644 (file)
@@ -234,7 +234,8 @@ static bool torture_smb2_notify_dir(struct torture_context *torture,
        union smb_open io;
        union smb_close cl;
        int i, count;
-       struct smb2_handle h1, h2;
+       struct smb2_handle h1 = {{0}};
+       struct smb2_handle h2 = {{0}};
        struct smb2_request *req, *req2;
        const char *fname = BASEDIR "\\subdir-name";
        extern int torture_numops;
@@ -2110,7 +2111,7 @@ static bool torture_smb2_notify_tcon(struct torture_context *torture,
        NTSTATUS status;
        union smb_notify notify;
        union smb_open io;
-       struct smb2_handle h1;
+       struct smb2_handle h1 = {{0}};
        struct smb2_request *req = NULL;
        struct smb2_tree *tree1 = NULL;
        const char *fname = BASEDIR "\\subdir-name";
index 8c3f16152759522ed21ca20d22e0f99ce90a980b..e48a217fe945eeaf3f6e2769c89f1da20f80345e 100644 (file)
@@ -675,7 +675,8 @@ static bool test_stream_delete(struct torture_context *tctx,
        const char *fname = DNAME "\\stream_delete.txt";
        const char *sname1;
        bool ret = true;
-       struct smb2_handle h, h1;
+       struct smb2_handle h = {{0}};
+       struct smb2_handle h1 = {{0}};
        struct smb2_read r;
 
        if (torture_setting_bool(tctx, "samba4", false)) {
@@ -1146,7 +1147,8 @@ static bool test_stream_names2(struct torture_context *tctx,
        union smb_open io;
        const char *fname = DNAME "\\stream_names2.txt";
        bool ret = true;
-       struct smb2_handle h, h1;
+       struct smb2_handle h = {{0}};
+       struct smb2_handle h1 = {{0}};
        uint8_t i;
 
        smb2_util_unlink(tree, fname);
@@ -1247,7 +1249,8 @@ static bool test_stream_rename(struct torture_context *tctx,
        union smb_fileinfo finfo1;
        union smb_setfileinfo sfinfo;
        bool ret = true;
-       struct smb2_handle h, h1;
+       struct smb2_handle h = {{0}};
+       struct smb2_handle h1 = {{0}};
 
        sname1 = talloc_asprintf(mem_ctx, "%s:%s", fname, "Stream One");
        sname2 = talloc_asprintf(mem_ctx, "%s:%s:$DaTa", fname,
@@ -1506,7 +1509,8 @@ static bool test_stream_create_disposition(struct torture_context *tctx,
        const char *default_stream_name = "::$DATA";
        const char *stream_list[2];
        bool ret = true;
-       struct smb2_handle h, h1;
+       struct smb2_handle h = {{0}};
+       struct smb2_handle h1 = {{0}};
 
        /* clean slate .. */
        smb2_util_unlink(tree, fname);
index df4dd299fe02ae4ffb214696717836c0d3292fcf..676d01221b0d07aaa75f3b86764368cf6b68a8fd 100644 (file)
@@ -91,7 +91,8 @@ static bool test_default_acl_posix(struct torture_context *tctx,
        bool ret = true;
        const char *dname = BASEDIR "\\testdir";
        const char *fname = BASEDIR "\\testdir\\testfile";
-       struct smb2_handle fhandle, dhandle;
+       struct smb2_handle fhandle = {{0}};
+       struct smb2_handle dhandle = {{0}};
        union smb_fileinfo q;
        union smb_setfileinfo set;
        struct security_descriptor *sd = NULL;
@@ -200,7 +201,8 @@ static bool test_default_acl_win(struct torture_context *tctx,
        bool ret = true;
        const char *dname = BASEDIR "\\testdir";
        const char *fname = BASEDIR "\\testdir\\testfile";
-       struct smb2_handle fhandle, dhandle;
+       struct smb2_handle fhandle = {{0}};
+       struct smb2_handle dhandle = {{0}};
        union smb_fileinfo q;
        union smb_setfileinfo set;
        struct security_descriptor *sd = NULL;