[PATCH] Fix new Coverity Defects

Volker Lendecke Volker.Lendecke at SerNet.DE
Tue Jul 21 10:42:13 UTC 2015


Hi!

Review&push appreciated!

Thanks,

Volker

-- 
SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
http://www.sernet.de, mailto:kontakt at sernet.de
-------------- next part --------------
From ea790b7bd7a255aedf1334603f845ba52f6b6001 Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Tue, 21 Jul 2015 09:45:23 +0200
Subject: [PATCH 1/2] vfs: Fix CID 1312073 Argument cannot be negative

Signed-off-by: Volker Lendecke <vl at samba.org>
---
 source3/modules/vfs_default.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c
index 490c4ab..fa547d8 100644
--- a/source3/modules/vfs_default.c
+++ b/source3/modules/vfs_default.c
@@ -706,7 +706,7 @@ static bool vfswrap_init_asys_ctx(struct smbd_server_connection *conn)
 
 	ret = set_blocking(fd, false);
 	if (ret != 0) {
-		DBG_WARNING("set_blocking failed: %s\n", strerror(ret));
+		DBG_WARNING("set_blocking failed: %s\n", strerror(errno));
 		goto fail;
 	}
 
-- 
1.9.1


From 001cced2cce625d0e1111dc9dd4dbfe9187e4bc0 Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Tue, 21 Jul 2015 09:51:09 +0200
Subject: [PATCH 2/2] vfs: Fix CID 1312072 Failure to restore non-local value

Signed-off-by: Volker Lendecke <vl at samba.org>
---
 source3/modules/vfs_default.c | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c
index fa547d8..10d0f3b 100644
--- a/source3/modules/vfs_default.c
+++ b/source3/modules/vfs_default.c
@@ -690,19 +690,22 @@ static void vfswrap_asys_finished(struct tevent_context *ev,
 
 static bool vfswrap_init_asys_ctx(struct smbd_server_connection *conn)
 {
+	struct asys_context *ctx;
+	struct tevent_fd *fde;
 	int ret;
 	int fd;
 
 	if (conn->asys_ctx != NULL) {
 		return true;
 	}
-	ret = asys_context_init(&conn->asys_ctx, aio_pending_size);
+
+	ret = asys_context_init(&ctx, aio_pending_size);
 	if (ret != 0) {
 		DEBUG(1, ("asys_context_init failed: %s\n", strerror(ret)));
 		return false;
 	}
 
-	fd = asys_signalfd(conn->asys_ctx);
+	fd = asys_signalfd(ctx);
 
 	ret = set_blocking(fd, false);
 	if (ret != 0) {
@@ -710,19 +713,19 @@ static bool vfswrap_init_asys_ctx(struct smbd_server_connection *conn)
 		goto fail;
 	}
 
-	conn->asys_fde = tevent_add_fd(conn->ev_ctx, conn, fd,
-				       TEVENT_FD_READ,
-				       vfswrap_asys_finished,
-				       conn->asys_ctx);
-	if (conn->asys_fde == NULL) {
+	fde = tevent_add_fd(conn->ev_ctx, conn, fd, TEVENT_FD_READ,
+			    vfswrap_asys_finished, ctx);
+	if (fde == NULL) {
 		DEBUG(1, ("tevent_add_fd failed\n"));
 		goto fail;
 	}
+
+	conn->asys_ctx = ctx;
+	conn->asys_fde = fde;
 	return true;
 
 fail:
-	asys_context_destroy(conn->asys_ctx);
-	conn->asys_ctx = NULL;
+	asys_context_destroy(ctx);
 	return false;
 }
 
-- 
1.9.1



More information about the samba-technical mailing list