[PATCH] fix some compile warnings

Christian Ambach ambi at samba.org
Thu Feb 11 16:08:49 UTC 2016


Hi list,

on my machine, some warnings came up when using -O3 and 
./configure.developer --enable-coverage --picky-developer that made the 
build abort.

Review and push appreciated

Cheers,
Christian
-------------- next part --------------
From 25e7985af3b5c8821ba4b8084b3613b6445ec7ea Mon Sep 17 00:00:00 2001
From: Christian Ambach <ambi at samba.org>
Date: Sat, 6 Feb 2016 10:49:53 +0100
Subject: [PATCH 1/4] s4:heimdal fix a compile warning

about a potentially uninitialized variable

Signed-off-by: Christian Ambach <ambi at samba.org>
---
 source4/heimdal/lib/krb5/fcache.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/source4/heimdal/lib/krb5/fcache.c b/source4/heimdal/lib/krb5/fcache.c
index cb720c0..4cc4880 100644
--- a/source4/heimdal/lib/krb5/fcache.c
+++ b/source4/heimdal/lib/krb5/fcache.c
@@ -690,8 +690,8 @@ fcc_get_principal(krb5_context context,
 		  krb5_principal *principal)
 {
     krb5_error_code ret;
-    int fd;
-    krb5_storage *sp;
+    int fd = 0;
+    krb5_storage *sp = NULL;
 
     ret = init_fcc (context, id, &sp, &fd, NULL);
     if (ret)
-- 
1.9.1


From 6e91546118776789cf5a2f0a41cfd5a4b0666515 Mon Sep 17 00:00:00 2001
From: Christian Ambach <ambi at samba.org>
Date: Mon, 8 Feb 2016 23:20:19 +0100
Subject: [PATCH 2/4] s4:torture/ntlmssp fix a compiler warning

about invalid array subscript

Signed-off-by: Christian Ambach <ambi at samba.org>
---
 source4/torture/ndr/ntlmssp.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/source4/torture/ndr/ntlmssp.c b/source4/torture/ndr/ntlmssp.c
index 5b879c6..ae56192 100644
--- a/source4/torture/ndr/ntlmssp.c
+++ b/source4/torture/ndr/ntlmssp.c
@@ -48,7 +48,6 @@ static bool ntlmssp_NEGOTIATE_MESSAGE_check(struct torture_context *tctx,
 	torture_assert_int_equal(tctx, r->Version.version.Reserved[0], 0x00, "Reserved");
 	torture_assert_int_equal(tctx, r->Version.version.Reserved[1], 0x00, "Reserved");
 	torture_assert_int_equal(tctx, r->Version.version.Reserved[2], 0x00, "Reserved");
-	torture_assert_int_equal(tctx, r->Version.version.Reserved[3], 0x00, "Reserved");
 	torture_assert_int_equal(tctx, r->Version.version.NTLMRevisionCurrent, NTLMSSP_REVISION_W2K3, "NTLMRevisionCurrent");
 
 	return true;
@@ -116,7 +115,6 @@ static bool ntlmssp_CHALLENGE_MESSAGE_check(struct torture_context *tctx,
 	torture_assert_int_equal(tctx, r->Version.version.Reserved[0], 0x00, "Reserved");
 	torture_assert_int_equal(tctx, r->Version.version.Reserved[1], 0x00, "Reserved");
 	torture_assert_int_equal(tctx, r->Version.version.Reserved[2], 0x00, "Reserved");
-	torture_assert_int_equal(tctx, r->Version.version.Reserved[3], 0x00, "Reserved");
 	torture_assert_int_equal(tctx, r->Version.version.NTLMRevisionCurrent, NTLMSSP_REVISION_W2K3, "NTLMRevisionCurrent");
 
 	return true;
@@ -270,7 +268,6 @@ static bool ntlmssp_AUTHENTICATE_MESSAGE_check(struct torture_context *tctx,
 	torture_assert_int_equal(tctx, r->Version.version.Reserved[0], 0x00, "Reserved");
 	torture_assert_int_equal(tctx, r->Version.version.Reserved[1], 0x00, "Reserved");
 	torture_assert_int_equal(tctx, r->Version.version.Reserved[2], 0x00, "Reserved");
-	torture_assert_int_equal(tctx, r->Version.version.Reserved[3], 0x00, "Reserved");
 	torture_assert_int_equal(tctx, r->Version.version.NTLMRevisionCurrent, NTLMSSP_REVISION_W2K3, "NTLMRevisionCurrent");
 
 	return true;
-- 
1.9.1


From d41b71d4f20cc8a02905434e1edd7cd5f67e28ae Mon Sep 17 00:00:00 2001
From: Christian Ambach <ambi at samba.org>
Date: Mon, 8 Feb 2016 23:22:26 +0100
Subject: [PATCH 3/4] s3:vfs_fruit fix a compiler warning

about a potentially uninitialized variable

Signed-off-by: Christian Ambach <ambi at samba.org>
---
 source3/modules/vfs_fruit.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/source3/modules/vfs_fruit.c b/source3/modules/vfs_fruit.c
index cb0d284..e33521e 100644
--- a/source3/modules/vfs_fruit.c
+++ b/source3/modules/vfs_fruit.c
@@ -2630,7 +2630,7 @@ static ssize_t fruit_pread(vfs_handle_struct *handle,
 		handle, fsp);
 	struct fruit_config_data *config = NULL;
 	AfpInfo *ai = NULL;
-	ssize_t len;
+	ssize_t len = -1;
 	char *name = NULL;
 	char *tmp_base_name = NULL;
 	NTSTATUS status;
-- 
1.9.1


From aa8055eb0d9c9e146c88466b06d1bbfcd9913c33 Mon Sep 17 00:00:00 2001
From: Christian Ambach <ambi at samba.org>
Date: Mon, 8 Feb 2016 23:22:55 +0100
Subject: [PATCH 4/4] s3:winbindd/idmap_autorid_tdb fix a compiler warning

about a potentially uninitialized variable

Signed-off-by: Christian Ambach <ambi at samba.org>
---
 source3/winbindd/idmap_autorid_tdb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/source3/winbindd/idmap_autorid_tdb.c b/source3/winbindd/idmap_autorid_tdb.c
index 89c3ad7..2f09f6c 100644
--- a/source3/winbindd/idmap_autorid_tdb.c
+++ b/source3/winbindd/idmap_autorid_tdb.c
@@ -602,7 +602,7 @@ static NTSTATUS idmap_autorid_delete_range_by_num_action(struct db_context *db,
 	struct idmap_autorid_delete_range_by_num_ctx *ctx =
 		(struct idmap_autorid_delete_range_by_num_ctx *)private_data;
 	uint32_t rangenum;
-	char *keystr;
+	char *keystr = NULL;
 	char *range_keystr;
 	TDB_DATA val;
 	NTSTATUS status;
-- 
1.9.1



More information about the samba-technical mailing list