s4:torture:rpc: fix valgrind 'Syscall param writev(vector[...])' valgrind error
authorNoel Power <noel.power@suse.com>
Fri, 15 Apr 2016 14:59:08 +0000 (15:59 +0100)
committerAndreas Schneider <asn@cryptomilk.org>
Mon, 25 Apr 2016 08:35:14 +0000 (10:35 +0200)
when running smbtorture rpc.samba3.regconfig.regconfig

Note: to fix this particular error only the action_taken variable needed
to be initialised. ZERO-ing the structs for completeness.

==14958== Syscall param writev(vector[...]) points to uninitialised byte(s)
==14958==    at 0xFB9FC87: writev (in /lib64/libc-2.19.so)
==14958==    by 0x106C8003: writev_handler (async_sock.c:340)
==14958==    by 0xF67407E: epoll_event_loop (tevent_epoll.c:728)
==14958==    by 0xF67469C: epoll_event_loop_once (tevent_epoll.c:926)
==14958==    by 0xF671586: std_event_loop_once (tevent_standard.c:114)
==14958==    by 0xF66AD42: _tevent_loop_once (tevent.c:533)
==14958==    by 0xF66CB9D: tevent_req_poll (tevent_req.c:256)
==14958==    by 0x5D19305: tevent_req_poll_ntstatus (tevent_ntstatus.c:109)
==14958==    by 0x88B2DED: dcerpc_binding_handle_call (binding_handle.c:556)
==14958==    by 0xBBCE851: dcerpc_winreg_CreateKey_r (ndr_winreg_c.c:1430)
==14958==    by 0x3D47C5: torture_samba3_createshare (samba3rpc.c:3192)
==14958==    by 0x3D50AC: torture_samba3_regconfig (samba3rpc.c:3299)
==14958==    by 0x9553F42: wrap_simple_test (torture.c:632)
==14958==    by 0x955366F: internal_torture_run_test (torture.c:442)
==14958==    by 0x9553A4B: torture_run_test_restricted (torture.c:542)
==14958==    by 0x260074: run_matching (smbtorture.c:110)
==14958==    by 0x25FF36: run_matching (smbtorture.c:95)
==14958==    by 0x25FF36: run_matching (smbtorture.c:95)
==14958==    by 0x260195: torture_run_named_tests (smbtorture.c:143)
==14958==    by 0x261E14: main (smbtorture.c:665)
==14958==  Address 0x18868ec6 is 598 bytes inside a block of size 1,325 alloc'd
==14958==    at 0x4C29110: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==14958==    by 0xF45EE38: __talloc_with_prefix (talloc.c:668)
==14958==    by 0xF45EFF5: _talloc_pool (talloc.c:721)
==14958==    by 0xF45F167: _talloc_pooled_object (talloc.c:790)
==14958==    by 0xF66C664: _tevent_req_create (tevent_req.c:66)
==14958==    by 0xB0D49CF: smb1cli_req_create (smbXcli_base.c:1322)
==14958==    by 0xB0E1E3D: smb1cli_trans_send (smb1cli_trans.c:512)
==14958==    by 0xB0ED44D: tstream_smbXcli_np_readv_trans_start (tstream_smbXcli_np.c:901)
==14958==    by 0xB0EC817: tstream_smbXcli_np_writev_write_next (tstream_smbXcli_np.c:578)
==14958==    by 0xB0EC4A7: tstream_smbXcli_np_writev_send (tstream_smbXcli_np.c:505)
==14958==    by 0xC259DDA: tstream_writev_send (tsocket.c:695)
==14958==    by 0xC25AD44: tstream_writev_queue_trigger (tsocket_helpers.c:513)
==14958==    by 0xF66BF73: tevent_queue_immediate_trigger (tevent_queue.c:149)
==14958==    by 0xF66BBFB: tevent_common_loop_immediate (tevent_immediate.c:135)
==14958==    by 0xF674602: epoll_event_loop_once (tevent_epoll.c:907)
==14958==    by 0xF671586: std_event_loop_once (tevent_standard.c:114)
==14958==    by 0xF66AD42: _tevent_loop_once (tevent.c:533)
==14958==    by 0xF66CB9D: tevent_req_poll (tevent_req.c:256)
==14958==    by 0x5D19305: tevent_req_poll_ntstatus (tevent_ntstatus.c:109)
==14958==    by 0x88B2DED: dcerpc_binding_handle_call (binding_handle.c:556)
==14958==    by 0xBBCE851: dcerpc_winreg_CreateKey_r (ndr_winreg_c.c:1430)
==14958==    by 0x3D47C5: torture_samba3_createshare (samba3rpc.c:3192)
==14958==    by 0x3D50AC: torture_samba3_regconfig (samba3rpc.c:3299)

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
source4/torture/rpc/samba3rpc.c

index a578e8cf164dbb088b2fc06dc00448eabee038bc..9da6b54e6ffcf5e21c4c210a5d6cc7af82931173 100644 (file)
@@ -3165,7 +3165,12 @@ static bool torture_samba3_createshare(struct torture_context *tctx,
        struct policy_handle new_handle;
        struct winreg_CreateKey c;
        struct winreg_CloseKey cl;
-       enum winreg_CreateAction action_taken;
+       enum winreg_CreateAction action_taken = REG_ACTION_NONE;
+
+       ZERO_STRUCT(c);
+       ZERO_STRUCT(cl);
+       ZERO_STRUCT(hklm);
+       ZERO_STRUCT(new_handle);
 
        c.in.handle = &hklm;
        c.in.name.name = talloc_asprintf(