[SCM] Samba Shared Repository - branch master updated

Gary Lockyer gary at samba.org
Wed Jul 24 22:51:02 UTC 2019


The branch, master has been updated
       via  3913b9a4088 s3/lib: clang: Fix 'access to field results in a deref of a null pointer'
       via  81f8cbfba35 s3/lib: clang: Fix 'function call argument is an uninitialized value'
       via  1d651a8d584 s3/lib: clang: Fix 'Acces to field results in a deref of a null pointer'
       via  be2b69feceb lib/addns: clang: Fix 'Assigned value is garbage or undefined'
       via  da4c1c5f396 lib/addns: clang: Fix 'Value stored to 'err' is never read'
       via  6baf0208eb8 libcls/nbt: clang: Fix 'initialization value is never read'
       via  637cd1a6c41 s3/lib/dbwrap: clang: Fix 'Access to field results in a deref of a null'
       via  6858c83dc62 s3/lib/dwrap: clang: Fix 'Value stored to 'ret' is never read'
       via  849ffbc8251 lib/adnss: clang: Fix The left operand of '!=' is a garbage value
       via  90e36ef7299 libcli/smb: clang: Fix Value stored to 'next_offset' is never read
      from  e77237bb46c s4/dsdb/replmd: use incoming_dn_should_be_renamed() 2/2

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 3913b9a4088b83d6ed7f94d136a26ecfa7e16b35
Author: Noel Power <noel.power at suse.com>
Date:   Tue Jul 9 16:07:09 2019 +0000

    s3/lib: clang: Fix 'access to field results in a deref of a null pointer'
    
    Fixes:
    
    source3/lib/ctdbd_conn.c:1953:6: warning: Access to field 'operation' results in a dereference of a null pointer (loaded from variable 'hdr') <--[clang]
            if (hdr->operation != CTDB_REPLY_CALL) {
                ^~~
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>
    
    Autobuild-User(master): Gary Lockyer <gary at samba.org>
    Autobuild-Date(master): Wed Jul 24 22:50:27 UTC 2019 on sn-devel-184

commit 81f8cbfba358b61e7b394887d23f751691eb8388
Author: Noel Power <noel.power at suse.com>
Date:   Tue Jul 9 16:05:37 2019 +0000

    s3/lib: clang: Fix 'function call argument is an uninitialized value'
    
    Fixes:
    
    source3/lib/ctdbd_conn.c:1066:3: warning: 3rd function call argument is an uninitialized value <--[clang]
                    DEBUG(0,("ctdbd_control failed: %s, %d\n", strerror(ret),
                    ^
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

commit 1d651a8d5847c1ecd87d5f1bbfc7714e078d60f2
Author: Noel Power <noel.power at suse.com>
Date:   Tue Jul 9 16:02:47 2019 +0000

    s3/lib: clang: Fix 'Acces to field results in a deref of a null pointer'
    
    Fixes:
    
    source3/lib/ctdbd_conn.c:415:6: warning: Access to field 'operation' results in a dereference of a null pointer (loaded from variable 'hdr') <--[clang]
            if (hdr->operation == CTDB_REQ_MESSAGE) {
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

commit be2b69fecebd35d7a60057d6515e4401d3ce1294
Author: Noel Power <noel.power at suse.com>
Date:   Tue Jul 9 15:06:30 2019 +0000

    lib/addns: clang: Fix 'Assigned value is garbage or undefined'
    
    Fixes:
    
    lib/addns/dnsquery.c:222:10: warning: Assigned value is garbage or undefined <--[clang]
            *numdcs = num_srvs;     /* size_t->int */
                    ^
    1 warning generated.
    
    Also fixes the out param being modified even on failure
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

commit da4c1c5f39669274bf8ff5a0974b4111f80be798
Author: Noel Power <noel.power at suse.com>
Date:   Tue Jul 9 14:50:24 2019 +0000

    lib/addns: clang: Fix 'Value stored to 'err' is never read'
    
    Fixes:
    
    /home/samba/samba/lib/addns/dnsmarshall.c:406:2: warning: Value stored to 'err' is never read <--[clang]
            err = ERROR_DNS_NO_MEMORY;
            ^     ~~~~~~~~~~~~~~~~~~~
    /home/samba/samba/lib/addns/dnsmarshall.c:447:3: warning: Value stored to 'err' is never read <--[clang]
                    err = buf->error;
                    ^     ~~~~~~~~~~
    2 warnings generated.
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

commit 6baf0208eb85e834138f666153f94e8327e84996
Author: Noel Power <noel.power at suse.com>
Date:   Tue Jul 9 14:45:52 2019 +0000

    libcls/nbt: clang: Fix 'initialization value is never read'
    
    Fixes:
    
    libcli/nbt/nbtsocket.c:65:27: warning: Value stored to 'req' during its initialization is never read <--[clang]
            struct nbt_name_request *req = nbtsock->send_queue;
                                     ^~~   ~~~~~~~~~~~~~~~~~~~
    1 warning generated.
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

commit 637cd1a6c4175c527caa144767f3543156c66ed5
Author: Noel Power <noel.power at suse.com>
Date:   Tue Jul 9 14:42:46 2019 +0000

    s3/lib/dbwrap: clang: Fix 'Access to field results in a deref of a null'
    
    Fixes:
    
    source3/lib/dbwrap/dbwrap_ctdb.c:530:39: warning: Access to field 'm_write' results in a dereference of a null pointer (loaded from field 'transaction') <--[clang]
            if (pull_newest_from_marshall_buffer(ctx->transaction->m_write, key,
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

commit 6858c83dc625ab2d4c02c702f8f5351805df0ae1
Author: Noel Power <noel.power at suse.com>
Date:   Tue Jul 9 14:13:13 2019 +0000

    s3/lib/dwrap: clang: Fix 'Value stored to 'ret' is never read'
    
    Fixes:
    
    source3/lib/dbwrap/dbwrap_ctdb.c:95:2: warning: Value stored to 'ret' is never read <--[clang]
            ret = ctdbd_init_connection(mem_ctx,
            ^     ~~~~~~
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

commit 849ffbc8251aa193cfcab043ab7c818a666a4a68
Author: Noel Power <noel.power at suse.com>
Date:   Tue Jul 9 14:08:49 2019 +0000

    lib/adnss: clang: Fix The left operand of '!=' is a garbage value
    
    Fixes:
    
    lib/addns/dnssock.c:143:3: warning: The left operand of '!=' is a garbage value <--[clang]
                    TALLOC_FREE(conn);
                    ^
    1 warning generated.
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

commit 90e36ef72992a073ba92e736f4533a10f3f5248f
Author: Noel Power <noel.power at suse.com>
Date:   Tue Jul 9 14:04:34 2019 +0000

    libcli/smb: clang: Fix Value stored to 'next_offset' is never read
    
    Fixes:
    
    ibcli/smb/smb2_negotiate_context.c:117:3: warning: Value stored to 'next_offset' is never read <--[clang]
                    next_offset += next_pad;
                    ^              ~~~~~~~~
    1 warning generated.
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

-----------------------------------------------------------------------

Summary of changes:
 lib/addns/dnsmarshall.c             | 10 ++++++----
 lib/addns/dnsquery.c                |  6 ++++--
 lib/addns/dnssock.c                 |  2 +-
 libcli/nbt/nbtsocket.c              |  2 +-
 libcli/smb/smb2_negotiate_context.c |  1 -
 source3/lib/ctdbd_conn.c            |  9 +++++----
 source3/lib/dbwrap/dbwrap_ctdb.c    |  7 ++++++-
 7 files changed, 23 insertions(+), 14 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/addns/dnsmarshall.c b/lib/addns/dnsmarshall.c
index 3205786cbbb..a07ed784ce1 100644
--- a/lib/addns/dnsmarshall.c
+++ b/lib/addns/dnsmarshall.c
@@ -388,10 +388,10 @@ DNS_ERROR dns_unmarshall_request(TALLOC_CTX *mem_ctx,
 {
 	struct dns_request *req;
 	uint16_t i;
-	DNS_ERROR err;
+	DNS_ERROR err = ERROR_DNS_NO_MEMORY;
 
 	if (!(req = talloc_zero(mem_ctx, struct dns_request))) {
-		return ERROR_DNS_NO_MEMORY;
+		return err;
 	}
 
 	dns_unmarshall_uint16(buf, &req->id);
@@ -401,7 +401,10 @@ DNS_ERROR dns_unmarshall_request(TALLOC_CTX *mem_ctx,
 	dns_unmarshall_uint16(buf, &req->num_auths);
 	dns_unmarshall_uint16(buf, &req->num_additionals);
 
-	if (!ERR_DNS_IS_OK(buf->error)) goto error;
+	if (!ERR_DNS_IS_OK(buf->error)){
+		err = buf->error;
+		goto error;
+	}
 
 	err = ERROR_DNS_NO_MEMORY;
 
@@ -452,7 +455,6 @@ DNS_ERROR dns_unmarshall_request(TALLOC_CTX *mem_ctx,
 	return ERROR_DNS_SUCCESS;
 
  error:
-	err = buf->error;
 	TALLOC_FREE(req);
 	return err;
 }
diff --git a/lib/addns/dnsquery.c b/lib/addns/dnsquery.c
index 87ae97e3d0b..90e4de9a053 100644
--- a/lib/addns/dnsquery.c
+++ b/lib/addns/dnsquery.c
@@ -205,7 +205,7 @@ NTSTATUS ads_dns_lookup_srv(TALLOC_CTX *ctx,
 	struct tevent_context *ev;
 	struct tevent_req *req;
 	NTSTATUS status = NT_STATUS_NO_MEMORY;
-	size_t num_srvs;
+	size_t num_srvs = 0;
 
 	ev = samba_tevent_context_init(ctx);
 	if (ev == NULL) {
@@ -219,7 +219,9 @@ NTSTATUS ads_dns_lookup_srv(TALLOC_CTX *ctx,
 		goto fail;
 	}
 	status = ads_dns_lookup_srv_recv(req, ctx, dclist, &num_srvs);
-	*numdcs = num_srvs;	/* size_t->int */
+	if (NT_STATUS_IS_OK(status)) {
+		*numdcs = num_srvs;	/* size_t->int */
+	}
 fail:
 	TALLOC_FREE(ev);
 	return status;
diff --git a/lib/addns/dnssock.c b/lib/addns/dnssock.c
index 30b8fa2eaf4..11f2e00a57b 100644
--- a/lib/addns/dnssock.c
+++ b/lib/addns/dnssock.c
@@ -125,7 +125,7 @@ static DNS_ERROR dns_udp_open( const char *nameserver,
 {
 	struct addrinfo hints;
 	struct sockaddr_storage RecvAddr;
-	struct dns_connection *conn;
+	struct dns_connection *conn = NULL;
 	DNS_ERROR dns_ret;
 	socklen_t RecvAddrLen;
 	char service[16];
diff --git a/libcli/nbt/nbtsocket.c b/libcli/nbt/nbtsocket.c
index 33d53fba993..38a2192fbcd 100644
--- a/libcli/nbt/nbtsocket.c
+++ b/libcli/nbt/nbtsocket.c
@@ -62,7 +62,7 @@ static int nbt_name_request_destructor(struct nbt_name_request *req)
 */
 static void nbt_name_socket_send(struct nbt_name_socket *nbtsock)
 {
-	struct nbt_name_request *req = nbtsock->send_queue;
+	struct nbt_name_request *req;
 	TALLOC_CTX *tmp_ctx = talloc_new(nbtsock);
 	NTSTATUS status;
 
diff --git a/libcli/smb/smb2_negotiate_context.c b/libcli/smb/smb2_negotiate_context.c
index ac4a08e8910..f9c98fcf805 100644
--- a/libcli/smb/smb2_negotiate_context.c
+++ b/libcli/smb/smb2_negotiate_context.c
@@ -114,7 +114,6 @@ static NTSTATUS smb2_negotiate_context_push_one(TALLOC_CTX *mem_ctx, DATA_BLOB *
 	memcpy(buffer->data+ofs+0x08, context->data.data, context->data.length);
 	if (next_pad > 0) {
 		memset(buffer->data+ofs+next_offset, 0, next_pad);
-		next_offset += next_pad;
 	}
 
 	return NT_STATUS_OK;
diff --git a/source3/lib/ctdbd_conn.c b/source3/lib/ctdbd_conn.c
index d5fac572d3c..8a8fbec4552 100644
--- a/source3/lib/ctdbd_conn.c
+++ b/source3/lib/ctdbd_conn.c
@@ -398,15 +398,16 @@ static int ctdb_read_packet(int fd, int timeout, TALLOC_CTX *mem_ctx,
 static int ctdb_read_req(struct ctdbd_connection *conn, uint32_t reqid,
 			 TALLOC_CTX *mem_ctx, struct ctdb_req_header **result)
 {
-	struct ctdb_req_header *hdr;
+	struct ctdb_req_header *hdr = NULL;
 	int ret;
 
  next_pkt:
 
 	ret = ctdb_read_packet(conn->fd, conn->timeout, mem_ctx, &hdr);
-	if (ret != 0) {
+	if (hdr == NULL || ret != 0) {
 		DBG_ERR("ctdb_read_packet failed: %s\n", strerror(ret));
 		cluster_fatal("failed to read data from ctdbd\n");
+		return -1;
 	}
 
 	DEBUG(11, ("Received ctdb packet\n"));
@@ -1038,7 +1039,7 @@ int ctdbd_traverse(struct ctdbd_connection *conn, uint32_t db_id,
 	int ret;
 	TDB_DATA key, data;
 	struct ctdb_traverse_start t;
-	int32_t cstatus;
+	int32_t cstatus = 0;
 
 	if (ctdbd_conn_has_async_reqs(conn)) {
 		/*
@@ -1945,7 +1946,7 @@ static void ctdbd_parse_done(struct tevent_req *subreq)
 
 	ret = ctdb_pkt_recv_recv(subreq, state, &hdr);
 	TALLOC_FREE(subreq);
-	if (tevent_req_error(req, ret)) {
+	if ((hdr == NULL) || tevent_req_error(req, ret)) {
 		DBG_ERR("ctdb_pkt_recv_recv returned %s\n", strerror(ret));
 		return;
 	}
diff --git a/source3/lib/dbwrap/dbwrap_ctdb.c b/source3/lib/dbwrap/dbwrap_ctdb.c
index b487d10bddb..0e108920f58 100644
--- a/source3/lib/dbwrap/dbwrap_ctdb.c
+++ b/source3/lib/dbwrap/dbwrap_ctdb.c
@@ -98,7 +98,7 @@ static int ctdb_async_ctx_init_internal(TALLOC_CTX *mem_ctx,
 				    &ctdb_async_ctx.async_conn);
 	unbecome_root();
 
-	if (ctdb_async_ctx.async_conn == NULL) {
+	if (ret != 0 || ctdb_async_ctx.async_conn == NULL) {
 		DBG_ERR("ctdbd_init_connection failed\n");
 		return EIO;
 	}
@@ -527,6 +527,11 @@ static struct db_record *db_ctdb_fetch_locked_transaction(struct db_ctdb_ctx *ct
 	result->storev = db_ctdb_storev_transaction;
 	result->delete_rec = db_ctdb_delete_transaction;
 
+	if (ctx->transaction == NULL) {
+		DEBUG(0, ("no transaction available\n"));
+		TALLOC_FREE(result);
+		return NULL;
+	}
 	if (pull_newest_from_marshall_buffer(ctx->transaction->m_write, key,
 					     NULL, result, &result->value)) {
 		return result;


-- 
Samba Shared Repository



More information about the samba-cvs mailing list