linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/10] nfs-utils compiler warning clean ups
@ 2012-10-22 16:05 Chuck Lever
  2012-10-22 16:05 ` [PATCH 01/10] nfs-utils: Eliminate dereferencing type punned pointers Chuck Lever
                   ` (11 more replies)
  0 siblings, 12 replies; 14+ messages in thread
From: Chuck Lever @ 2012-10-22 16:05 UTC (permalink / raw)
  To: steved; +Cc: linux-nfs

Hi-

These address compiler warnings in mountd and gssd that I've found
during recent sojourns in that code base.  I've done some light
testing, but more critical review and testing would be appreciated.

I think these are appropriate for your next release of nfs-utils.

---

Chuck Lever (10):
      rpc.gssd: Squelch compiler error
      rpc.gssd: Squelch compiler warning
      rpc.gssd: Squelch compiler warning
      mountd: Avoid unnecessary type conversions
      mountd: Avoid unnecessary type conversions
      mountd: Avoid unnecessary type conversions
      mountd: Make local functions static
      mountd: Eliminate unnecessary type conversions
      mountd: Avoid unnecessary type conversions
      nfs-utils: Eliminate dereferencing type punned pointers


 support/include/nfslib.h   |    1 +
 support/include/sockaddr.h |   10 ++++------
 support/nfs/cacheio.c      |    5 +++++
 utils/gssd/gss_util.c      |    2 +-
 utils/gssd/gssd_proc.c     |   13 +++++++------
 utils/mountd/cache.c       |   34 ++++++++++++++++++----------------
 6 files changed, 36 insertions(+), 29 deletions(-)

-- 
Chuck Lever

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 01/10] nfs-utils: Eliminate dereferencing type punned pointers
  2012-10-22 16:05 [PATCH 00/10] nfs-utils compiler warning clean ups Chuck Lever
@ 2012-10-22 16:05 ` Chuck Lever
  2012-10-22 16:05 ` [PATCH 02/10] mountd: Avoid unnecessary type conversions Chuck Lever
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 14+ messages in thread
From: Chuck Lever @ 2012-10-22 16:05 UTC (permalink / raw)
  To: steved; +Cc: linux-nfs

Clean up compiler warnings:

../../support/include/sockaddr.h: In function ‘compare_sockaddr6’:
../../support/include/sockaddr.h:197:2: warning: dereferencing
  type-punned pointer might break strict-aliasing rules
  [-Wstrict-aliasing]
../../support/include/sockaddr.h:198:7: warning: dereferencing
  type-punned pointer might break strict-aliasing rules
  [-Wstrict-aliasing]
../../support/include/sockaddr.h:199:6: warning: dereferencing
  type-punned pointer might break strict-aliasing rules
  [-Wstrict-aliasing]
../../support/include/sockaddr.h:200:7: warning: dereferencing
  type-punned pointer might break strict-aliasing rules
  [-Wstrict-aliasing]
../../support/include/sockaddr.h:204:2: warning: dereferencing
  type-punned pointer might break strict-aliasing rules
  [-Wstrict-aliasing]
../../support/include/sockaddr.h:204:2: warning: dereferencing
  type-punned pointer might break strict-aliasing rules
  [-Wstrict-aliasing]
../../support/include/sockaddr.h:204:2: warning: dereferencing
  type-punned pointer might break strict-aliasing rules
  [-Wstrict-aliasing]
../../support/include/sockaddr.h:204:2: warning: dereferencing
  type-punned pointer might break strict-aliasing rules
  [-Wstrict-aliasing]
../../support/include/sockaddr.h:204:2: warning: dereferencing
  type-punned pointer might break strict-aliasing rules
  [-Wstrict-aliasing]
../../support/include/sockaddr.h:204:2: warning: dereferencing
  type-punned pointer might break strict-aliasing rules
  [-Wstrict-aliasing]
../../support/include/sockaddr.h:204:2: warning: dereferencing
  type-punned pointer might break strict-aliasing rules
  [-Wstrict-aliasing]
../../support/include/sockaddr.h:204:2: warning: dereferencing
  type-punned pointer might break strict-aliasing rules
  [-Wstrict-aliasing]

Seen with gcc version 4.6.3 20120306 (Red Hat 4.6.3-2) (GCC)

Note also that site-local IPv6 addresses are deprecated, and thus
are no longer encountered.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---

 support/include/sockaddr.h |   10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/support/include/sockaddr.h b/support/include/sockaddr.h
index 9af2543..72766db 100644
--- a/support/include/sockaddr.h
+++ b/support/include/sockaddr.h
@@ -193,16 +193,14 @@ compare_sockaddr6(const struct sockaddr *sa1, const struct sockaddr *sa2)
 {
 	const struct sockaddr_in6 *sin1 = (const struct sockaddr_in6 *)sa1;
 	const struct sockaddr_in6 *sin2 = (const struct sockaddr_in6 *)sa2;
+	const struct in6_addr *saddr1 = &sin1->sin6_addr;
+	const struct in6_addr *saddr2 = &sin2->sin6_addr;
 
-	if ((IN6_IS_ADDR_LINKLOCAL((char *)&sin1->sin6_addr) &&
-	     IN6_IS_ADDR_LINKLOCAL((char *)&sin2->sin6_addr)) ||
-	    (IN6_IS_ADDR_SITELOCAL((char *)&sin1->sin6_addr) &&
-	     IN6_IS_ADDR_SITELOCAL((char *)&sin2->sin6_addr)))
+	if (IN6_IS_ADDR_LINKLOCAL(saddr1) && IN6_IS_ADDR_LINKLOCAL(saddr2))
 		if (sin1->sin6_scope_id != sin2->sin6_scope_id)
 			return false;
 
-	return IN6_ARE_ADDR_EQUAL((char *)&sin1->sin6_addr,
-					(char *)&sin2->sin6_addr);
+	return IN6_ARE_ADDR_EQUAL(saddr1, saddr2);
 }
 #else	/* !IPV6_SUPPORTED */
 static inline _Bool


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 02/10] mountd: Avoid unnecessary type conversions
  2012-10-22 16:05 [PATCH 00/10] nfs-utils compiler warning clean ups Chuck Lever
  2012-10-22 16:05 ` [PATCH 01/10] nfs-utils: Eliminate dereferencing type punned pointers Chuck Lever
@ 2012-10-22 16:05 ` Chuck Lever
  2012-10-22 16:06 ` [PATCH 03/10] mountd: Eliminate " Chuck Lever
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 14+ messages in thread
From: Chuck Lever @ 2012-10-22 16:05 UTC (permalink / raw)
  To: steved; +Cc: linux-nfs

Clean up compiler warnings:

cache.c: In function ‘auth_unix_ip’:
cache.c:121:29: warning: conversion to ‘unsigned int’ from ‘time_t’
  may alter its value [-Wconversion]

cache.c: In function ‘auth_unix_gid’:
cache.c:186:29: warning: conversion to ‘unsigned int’ from ‘time_t’
  may alter its value [-Wconversion]

cache.c: In function ‘dump_to_cache’:
cache.c:733:30: warning: conversion to ‘unsigned int’ from ‘time_t’
  may alter its value [-Wconversion]
cache.c:753:30: warning: conversion to ‘unsigned int’ from ‘time_t’
  may alter its value [-Wconversion]

cache.c: In function ‘cache_export’:
cache.c:1324:29: warning: conversion to ‘unsigned int’ from ‘time_t’
  may alter its value [-Wconversion]

Seen with gcc version 4.6.3 20120306 (Red Hat 4.6.3-2) (GCC)

We can take the opportunity to eliminate some code duplication.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---

 support/include/nfslib.h |    1 +
 support/nfs/cacheio.c    |    5 +++++
 utils/mountd/cache.c     |   10 +++++-----
 3 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/support/include/nfslib.h b/support/include/nfslib.h
index 73f3c20..f210a06 100644
--- a/support/include/nfslib.h
+++ b/support/include/nfslib.h
@@ -164,6 +164,7 @@ void qword_adduint(char **bpp, int *lp, unsigned int n);
 void qword_addeol(char **bpp, int *lp);
 int qword_get_uint(char **bpp, unsigned int *anint);
 void qword_printuint(FILE *f, unsigned int num);
+void qword_printtimefrom(FILE *f, unsigned int num);
 
 void closeall(int min);
 
diff --git a/support/nfs/cacheio.c b/support/nfs/cacheio.c
index 9bad8e6..e641c45 100644
--- a/support/nfs/cacheio.c
+++ b/support/nfs/cacheio.c
@@ -153,6 +153,11 @@ void qword_printuint(FILE *f, unsigned int num)
 	fprintf(f, "%u ", num);
 }
 
+void qword_printtimefrom(FILE *f, unsigned int num)
+{
+	fprintf(f, "%lu ", time(0) + num);
+}
+
 int qword_eol(FILE *f)
 {
 	int err;
diff --git a/utils/mountd/cache.c b/utils/mountd/cache.c
index 8280234..6de05f1 100644
--- a/utils/mountd/cache.c
+++ b/utils/mountd/cache.c
@@ -118,7 +118,7 @@ static void auth_unix_ip(FILE *f)
 	}
 	qword_print(f, "nfsd");
 	qword_print(f, ipaddr);
-	qword_printuint(f, time(0) + DEFAULT_TTL);
+	qword_printtimefrom(f, DEFAULT_TTL);
 	if (use_ipaddr)
 		qword_print(f, ipaddr);
 	else if (client)
@@ -183,7 +183,7 @@ static void auth_unix_gid(FILE *f)
 		}
 	}
 	qword_printuint(f, uid);
-	qword_printuint(f, time(0) + DEFAULT_TTL);
+	qword_printtimefrom(f, DEFAULT_TTL);
 	if (rv >= 0) {
 		qword_printuint(f, ngroups);
 		for (i=0; i<ngroups; i++)
@@ -730,7 +730,7 @@ static int dump_to_cache(FILE *f, char *domain, char *path, struct exportent *ex
 		int different_fs = strcmp(path, exp->e_path) != 0;
 		int flag_mask = different_fs ? ~NFSEXP_FSID : ~0;
 
-		qword_printuint(f, time(0) + exp->e_ttl);
+		qword_printtimefrom(f, exp->e_ttl);
 		qword_printint(f, exp->e_flags & flag_mask);
 		qword_printint(f, exp->e_anonuid);
 		qword_printint(f, exp->e_anongid);
@@ -750,7 +750,7 @@ static int dump_to_cache(FILE *f, char *domain, char *path, struct exportent *ex
  			qword_printhex(f, u, 16);
  		}
 	} else
-		qword_printuint(f, time(0) + DEFAULT_TTL);
+		qword_printtimefrom(f, DEFAULT_TTL);
 	return qword_eol(f);
 }
 
@@ -1339,7 +1339,7 @@ int cache_export(nfs_export *exp, char *path)
 	qword_print(f, "nfsd");
 	qword_print(f,
 		host_ntop(get_addrlist(exp->m_client, 0), buf, sizeof(buf)));
-	qword_printuint(f, time(0) + exp->m_export.e_ttl);
+	qword_printtimefrom(f, exp->m_export.e_ttl);
 	qword_print(f, exp->m_client->m_hostname);
 	err = qword_eol(f);
 	


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 03/10] mountd: Eliminate unnecessary type conversions
  2012-10-22 16:05 [PATCH 00/10] nfs-utils compiler warning clean ups Chuck Lever
  2012-10-22 16:05 ` [PATCH 01/10] nfs-utils: Eliminate dereferencing type punned pointers Chuck Lever
  2012-10-22 16:05 ` [PATCH 02/10] mountd: Avoid unnecessary type conversions Chuck Lever
@ 2012-10-22 16:06 ` Chuck Lever
  2012-10-22 16:06 ` [PATCH 04/10] mountd: Make local functions static Chuck Lever
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 14+ messages in thread
From: Chuck Lever @ 2012-10-22 16:06 UTC (permalink / raw)
  To: steved; +Cc: linux-nfs

Clean up compiler warnings:

cache.c:332:16: warning: conversion to ‘int’ from ‘size_t’ may alter
  its value [-Wconversion]
cache.c:339:9: warning: conversion to ‘size_t’ from ‘int’ may change
  the sign of the result [-Wsign-conversion]
cache.c: In function ‘subexport’:
cache.c:354:17: warning: conversion to ‘int’ from ‘size_t’ may alter
  its value [-Wconversion]
cache.c:357:9: warning: conversion to ‘size_t’ from ‘int’ may change
  the sign of the result [-Wsign-conversion]

Seen with gcc version 4.6.3 20120306 (Red Hat 4.6.3-2) (GCC) .

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---

 utils/mountd/cache.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/utils/mountd/cache.c b/utils/mountd/cache.c
index 6de05f1..70e1aa4 100644
--- a/utils/mountd/cache.c
+++ b/utils/mountd/cache.c
@@ -329,7 +329,7 @@ static char *next_mnt(void **v, char *p)
 {
 	FILE *f;
 	struct mntent *me;
-	int l = strlen(p);
+	size_t l = strlen(p);
 	if (*v == NULL) {
 		f = setmntent("/etc/mtab", "r");
 		*v = f;
@@ -351,7 +351,7 @@ static char *next_mnt(void **v, char *p)
 static bool subexport(struct exportent *e1, struct exportent *e2)
 {
 	char *p1 = e1->e_path, *p2 = e2->e_path;
-	int l2 = strlen(p2);
+	size_t l2 = strlen(p2);
 
 	return e2->e_flags & NFSEXP_CROSSMOUNT
 	       && strncmp(p1, p2, l2) == 0


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 04/10] mountd: Make local functions static
  2012-10-22 16:05 [PATCH 00/10] nfs-utils compiler warning clean ups Chuck Lever
                   ` (2 preceding siblings ...)
  2012-10-22 16:06 ` [PATCH 03/10] mountd: Eliminate " Chuck Lever
@ 2012-10-22 16:06 ` Chuck Lever
  2012-10-22 16:06 ` [PATCH 05/10] mountd: Avoid unnecessary type conversions Chuck Lever
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 14+ messages in thread
From: Chuck Lever @ 2012-10-22 16:06 UTC (permalink / raw)
  To: steved; +Cc: linux-nfs

Clean up compiler warnings:

cache.c: At top level:
cache.c:373:5: warning: no previous prototype for ‘parse_fsid’
  [-Wmissing-prototypes]

cache.c: At top level:
cache.c:504:18: warning: no previous prototype for
  ‘lookup_client_addr’ [-Wmissing-prototypes]

Seen with gcc version 4.6.3 20120306 (Red Hat 4.6.3-2) (GCC)

Once the parse_fsid() function was made static, the compiler
detected execution paths through it that did not initialize some
fields in *parsed.

[ I'm pretty sure these problems are currently harmless, since each
path is taken depending on the value of the .fsidtype field.  Each
path accesses only the fields in *parsed that it cares about. ]

cache.c: In function ‘nfsd_fh’:
cache.c:500:13: warning: ‘parsed.fhuuid’ may be used uninitialized
  in this function [-Wuninitialized]
cache.c:535:21: note: ‘parsed.fhuuid’ was declared here
cache.c:495:21: warning: ‘parsed.uuidlen’ may be used uninitialized
  in this function [-Wuninitialized]
cache.c:535:21: note: ‘parsed.uuidlen’ was declared here
cache.c:477:46: warning: ‘*((void *)&parsed+16)’ may be used
   uninitialized in this function [-Wuninitialized]
cache.c:535:21: note: ‘*((void *)&parsed+16)’ was declared here
cache.c:472:51: warning: ‘parsed.minor’ may be used uninitialized
  in this function [-Wuninitialized]
cache.c:535:21: note: ‘parsed.minor’ was declared here
cache.c:472:6: warning: ‘parsed.major’ may be used uninitialized
  in this function [-Wuninitialized]
cache.c:535:21: note: ‘parsed.major’ was declared here
cache.c:483:18: warning: ‘*((void *)&parsed+4)’ may be used
  uninitialized in this function [-Wuninitialized]
cache.c:535:21: note: ‘*((void *)&parsed+4)’ was declared here

This is because parsed_fsid isn't a union type.  parse_fsid() leaves
uninitialized fields that are not used by a particular fsidtype.  To
prevent an accidental dereference of stack garbage (.fhuuid being an
example of a pointer that is left uninitialized sometimes), have
parse_fsid() defensively pre-initialize *parsed to zero.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---

 utils/mountd/cache.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/utils/mountd/cache.c b/utils/mountd/cache.c
index 70e1aa4..57a3fed 100644
--- a/utils/mountd/cache.c
+++ b/utils/mountd/cache.c
@@ -370,11 +370,13 @@ struct parsed_fsid {
 	char *fhuuid;
 };
 
-int parse_fsid(int fsidtype, int fsidlen, char *fsid, struct parsed_fsid *parsed)
+static int parse_fsid(int fsidtype, int fsidlen, char *fsid,
+		struct parsed_fsid *parsed)
 {
 	unsigned int dev;
 	unsigned long long inode64;
 
+	memset(parsed, 0, sizeof(*parsed));
 	parsed->fsidtype = fsidtype;
 	switch(fsidtype) {
 	case FSID_DEV: /* 4 bytes: 2 major, 2 minor, 4 inode */
@@ -501,7 +503,7 @@ static bool match_fsid(struct parsed_fsid *parsed, nfs_export *exp, char *path)
 	return false;
 }
 
-struct addrinfo *lookup_client_addr(char *dom)
+static struct addrinfo *lookup_client_addr(char *dom)
 {
 	struct addrinfo *ret;
 	struct addrinfo *tmp;


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 05/10] mountd: Avoid unnecessary type conversions
  2012-10-22 16:05 [PATCH 00/10] nfs-utils compiler warning clean ups Chuck Lever
                   ` (3 preceding siblings ...)
  2012-10-22 16:06 ` [PATCH 04/10] mountd: Make local functions static Chuck Lever
@ 2012-10-22 16:06 ` Chuck Lever
  2012-10-22 16:06 ` [PATCH 06/10] " Chuck Lever
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 14+ messages in thread
From: Chuck Lever @ 2012-10-22 16:06 UTC (permalink / raw)
  To: steved; +Cc: linux-nfs

Clean up compiler warnings:

cache.c: In function ‘get_uuid’:
cache.c:249:2: warning: conversion to ‘size_t’ from ‘int’ may change
  the sign of the result [-Wsign-conversion]

And the like.

Seen with gcc version 4.6.3 20120306 (Red Hat 4.6.3-2) (GCC)

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---

 utils/mountd/cache.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/utils/mountd/cache.c b/utils/mountd/cache.c
index 57a3fed..64ca5ba 100644
--- a/utils/mountd/cache.c
+++ b/utils/mountd/cache.c
@@ -238,13 +238,13 @@ static const char *get_uuid_blkdev(char *path)
 #define get_uuid_blkdev(path) (NULL)
 #endif
 
-static int get_uuid(const char *val, int uuidlen, char *u)
+static int get_uuid(const char *val, size_t uuidlen, char *u)
 {
 	/* extract hex digits from uuidstr and compose a uuid
 	 * of the given length (max 16), xoring bytes to make
 	 * a smaller uuid.
 	 */
-	int i = 0;
+	size_t i = 0;
 	
 	memset(u, 0, uuidlen);
 	for ( ; *val ; val++) {
@@ -268,7 +268,7 @@ static int get_uuid(const char *val, int uuidlen, char *u)
 	return 1;
 }
 
-static int uuid_by_path(char *path, int type, int uuidlen, char *uuid)
+static int uuid_by_path(char *path, int type, size_t uuidlen, char *uuid)
 {
 	/* get a uuid for the filesystem found at 'path'.
 	 * There are several possible ways of generating the
@@ -366,7 +366,7 @@ struct parsed_fsid {
 	unsigned int minor;
 	unsigned int major;
 	unsigned int fsidnum;
-	int uuidlen;
+	size_t uuidlen;
 	char *fhuuid;
 };
 


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 06/10] mountd: Avoid unnecessary type conversions
  2012-10-22 16:05 [PATCH 00/10] nfs-utils compiler warning clean ups Chuck Lever
                   ` (4 preceding siblings ...)
  2012-10-22 16:06 ` [PATCH 05/10] mountd: Avoid unnecessary type conversions Chuck Lever
@ 2012-10-22 16:06 ` Chuck Lever
  2012-10-22 16:06 ` [PATCH 07/10] " Chuck Lever
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 14+ messages in thread
From: Chuck Lever @ 2012-10-22 16:06 UTC (permalink / raw)
  To: steved; +Cc: linux-nfs

Clean up compiler warnings:

cache.c: In function ‘is_subdirectory’:
cache.c:760:16: warning: conversion to ‘int’ from ‘size_t’ may
  alter its value [-Wconversion]
cache.c:763:3: warning: conversion to ‘size_t’ from ‘int’ may
  change the sign of the result [-Wsign-conversion]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---

 utils/mountd/cache.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/utils/mountd/cache.c b/utils/mountd/cache.c
index 64ca5ba..fbaa28e 100644
--- a/utils/mountd/cache.c
+++ b/utils/mountd/cache.c
@@ -758,7 +758,7 @@ static int dump_to_cache(FILE *f, char *domain, char *path, struct exportent *ex
 
 static int is_subdirectory(char *child, char *parent)
 {
-	int l = strlen(parent);
+	size_t l = strlen(parent);
 
 	return strcmp(child, parent) == 0
 		|| (strncmp(child, parent, l) == 0 && child[l] == '/');


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 07/10] mountd: Avoid unnecessary type conversions
  2012-10-22 16:05 [PATCH 00/10] nfs-utils compiler warning clean ups Chuck Lever
                   ` (5 preceding siblings ...)
  2012-10-22 16:06 ` [PATCH 06/10] " Chuck Lever
@ 2012-10-22 16:06 ` Chuck Lever
  2012-10-22 16:06 ` [PATCH 08/10] rpc.gssd: Squelch compiler warning Chuck Lever
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 14+ messages in thread
From: Chuck Lever @ 2012-10-22 16:06 UTC (permalink / raw)
  To: steved; +Cc: linux-nfs

Clean up compiler warnings:

cache.c: In function ‘get_uuid’:
cache.c:256:17: warning: conversion to ‘char’ from ‘int’ may
  alter its value [-Wconversion]
cache.c:258:17: warning: conversion to ‘char’ from ‘int’ may
  alter its value [-Wconversion]
cache.c:260:16: warning: conversion to ‘char’ from ‘int’ may
  alter its value [-Wconversion]
cache.c:262:6: warning: conversion to ‘char’ from ‘int’ may
  alter its value [-Wconversion]

Seen with gcc version 4.6.3 20120306 (Red Hat 4.6.3-2) (GCC)

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---

 utils/mountd/cache.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/utils/mountd/cache.c b/utils/mountd/cache.c
index fbaa28e..e950ec6 100644
--- a/utils/mountd/cache.c
+++ b/utils/mountd/cache.c
@@ -248,7 +248,7 @@ static int get_uuid(const char *val, size_t uuidlen, char *u)
 	
 	memset(u, 0, uuidlen);
 	for ( ; *val ; val++) {
-		char c = *val;
+		int c = *val;
 		if (!isxdigit(c))
 			continue;
 		if (isalpha(c)) {
@@ -260,7 +260,7 @@ static int get_uuid(const char *val, size_t uuidlen, char *u)
 			c = c - '0' + 0;
 		if ((i&1) == 0)
 			c <<= 4;
-		u[i/2] ^= c;
+		u[i/2] ^= (char)c;
 		i++;
 		if (i == uuidlen*2)
 			i = 0;


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 08/10] rpc.gssd: Squelch compiler warning
  2012-10-22 16:05 [PATCH 00/10] nfs-utils compiler warning clean ups Chuck Lever
                   ` (6 preceding siblings ...)
  2012-10-22 16:06 ` [PATCH 07/10] " Chuck Lever
@ 2012-10-22 16:06 ` Chuck Lever
  2012-10-22 16:07 ` [PATCH 09/10] " Chuck Lever
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 14+ messages in thread
From: Chuck Lever @ 2012-10-22 16:06 UTC (permalink / raw)
  To: steved; +Cc: linux-nfs

gss_util.c: At top level:
gss_util.c:98:36: warning: ISO C does not allow extra ‘;’ outside of a
function [-pedantic]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---

 utils/gssd/gss_util.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/utils/gssd/gss_util.c b/utils/gssd/gss_util.c
index 0e327b0..2e6d40f 100644
--- a/utils/gssd/gss_util.c
+++ b/utils/gssd/gss_util.c
@@ -95,7 +95,7 @@
 /* Global gssd_credentials handle */
 gss_cred_id_t gssd_creds;
 
-gss_OID g_mechOid = GSS_C_NULL_OID;;
+gss_OID g_mechOid = GSS_C_NULL_OID;
 
 #if 0
 static void


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 09/10] rpc.gssd: Squelch compiler warning
  2012-10-22 16:05 [PATCH 00/10] nfs-utils compiler warning clean ups Chuck Lever
                   ` (7 preceding siblings ...)
  2012-10-22 16:06 ` [PATCH 08/10] rpc.gssd: Squelch compiler warning Chuck Lever
@ 2012-10-22 16:07 ` Chuck Lever
  2012-10-22 16:07 ` [PATCH 10/10] rpc.gssd: Squelch compiler error Chuck Lever
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 14+ messages in thread
From: Chuck Lever @ 2012-10-22 16:07 UTC (permalink / raw)
  To: steved; +Cc: linux-nfs

gssd_proc.c: At top level:
gssd_proc.c:782:5: warning: no previous prototype for
‘create_auth_rpc_client’ [-Wmissing-prototypes]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---

 utils/gssd/gssd_proc.c |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/utils/gssd/gssd_proc.c b/utils/gssd/gssd_proc.c
index b9a898e..1bc3942 100644
--- a/utils/gssd/gssd_proc.c
+++ b/utils/gssd/gssd_proc.c
@@ -802,11 +802,12 @@ set_port:
  * Create an RPC connection and establish an authenticated
  * gss context with a server.
  */
-int create_auth_rpc_client(struct clnt_info *clp,
-			   CLIENT **clnt_return,
-			   AUTH **auth_return,
-			   uid_t uid,
-			   int authtype)
+static int
+create_auth_rpc_client(struct clnt_info *clp,
+		       CLIENT **clnt_return,
+		       AUTH **auth_return,
+		       uid_t uid,
+		       int authtype)
 {
 	CLIENT			*rpc_clnt = NULL;
 	struct rpc_gss_sec	sec;


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 10/10] rpc.gssd: Squelch compiler error
  2012-10-22 16:05 [PATCH 00/10] nfs-utils compiler warning clean ups Chuck Lever
                   ` (8 preceding siblings ...)
  2012-10-22 16:07 ` [PATCH 09/10] " Chuck Lever
@ 2012-10-22 16:07 ` Chuck Lever
  2012-10-22 17:27 ` [PATCH 00/10] nfs-utils compiler warning clean ups Steve Dickson
  2012-10-30 19:36 ` Steve Dickson
  11 siblings, 0 replies; 14+ messages in thread
From: Chuck Lever @ 2012-10-22 16:07 UTC (permalink / raw)
  To: steved; +Cc: linux-nfs

gssd_proc.c: In function ‘handle_krb5_upcall’:
gssd_proc.c:1117:2: warning: ISO C forbids ‘return’ with expression, in
function returning void [-pedantic]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---

 utils/gssd/gssd_proc.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/utils/gssd/gssd_proc.c b/utils/gssd/gssd_proc.c
index 1bc3942..ec251fa 100644
--- a/utils/gssd/gssd_proc.c
+++ b/utils/gssd/gssd_proc.c
@@ -1116,7 +1116,7 @@ handle_krb5_upcall(struct clnt_info *clp)
 		return;
 	}
 
-	return process_krb5_upcall(clp, uid, clp->krb5_fd, NULL, NULL);
+	process_krb5_upcall(clp, uid, clp->krb5_fd, NULL, NULL);
 }
 
 void


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH 00/10] nfs-utils compiler warning clean ups
  2012-10-22 16:05 [PATCH 00/10] nfs-utils compiler warning clean ups Chuck Lever
                   ` (9 preceding siblings ...)
  2012-10-22 16:07 ` [PATCH 10/10] rpc.gssd: Squelch compiler error Chuck Lever
@ 2012-10-22 17:27 ` Steve Dickson
  2012-10-22 17:31   ` Chuck Lever
  2012-10-30 19:36 ` Steve Dickson
  11 siblings, 1 reply; 14+ messages in thread
From: Steve Dickson @ 2012-10-22 17:27 UTC (permalink / raw)
  To: Chuck Lever; +Cc: linux-nfs



On 22/10/12 12:05, Chuck Lever wrote:
> Hi-
> 
> These address compiler warnings in mountd and gssd that I've found
> during recent sojourns in that code base.  I've done some light
> testing, but more critical review and testing would be appreciated.
> 
> I think these are appropriate for your next release of nfs-utils.
What CFLAGS do you use to see these warnings? Every time I do a build
I check for warnings and if I would have seen these I would have
fixed them immediately...   

BTW, I'm using gcc version 4.7.2 20120921 (Red Hat 4.7.2-2) (GCC)
to do my builds these days...

steved.

> 
> ---
> 
> Chuck Lever (10):
>       rpc.gssd: Squelch compiler error
>       rpc.gssd: Squelch compiler warning
>       rpc.gssd: Squelch compiler warning
>       mountd: Avoid unnecessary type conversions
>       mountd: Avoid unnecessary type conversions
>       mountd: Avoid unnecessary type conversions
>       mountd: Make local functions static
>       mountd: Eliminate unnecessary type conversions
>       mountd: Avoid unnecessary type conversions
>       nfs-utils: Eliminate dereferencing type punned pointers
> 
> 
>  support/include/nfslib.h   |    1 +
>  support/include/sockaddr.h |   10 ++++------
>  support/nfs/cacheio.c      |    5 +++++
>  utils/gssd/gss_util.c      |    2 +-
>  utils/gssd/gssd_proc.c     |   13 +++++++------
>  utils/mountd/cache.c       |   34 ++++++++++++++++++----------------
>  6 files changed, 36 insertions(+), 29 deletions(-)
> 

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 00/10] nfs-utils compiler warning clean ups
  2012-10-22 17:27 ` [PATCH 00/10] nfs-utils compiler warning clean ups Steve Dickson
@ 2012-10-22 17:31   ` Chuck Lever
  0 siblings, 0 replies; 14+ messages in thread
From: Chuck Lever @ 2012-10-22 17:31 UTC (permalink / raw)
  To: Steve Dickson; +Cc: linux-nfs@vger.kernel.org

The compiler flag that enables a warning is listed in square brackets at the end of each warning message.  Like:  [-wsigned-comparison]

Sent from my iPhone

On Oct 22, 2012, at 1:27 PM, Steve Dickson <SteveD@redhat.com> wrote:

> 
> 
> On 22/10/12 12:05, Chuck Lever wrote:
>> Hi-
>> 
>> These address compiler warnings in mountd and gssd that I've found
>> during recent sojourns in that code base.  I've done some light
>> testing, but more critical review and testing would be appreciated.
>> 
>> I think these are appropriate for your next release of nfs-utils.
> What CFLAGS do you use to see these warnings? Every time I do a build
> I check for warnings and if I would have seen these I would have
> fixed them immediately...   
> 
> BTW, I'm using gcc version 4.7.2 20120921 (Red Hat 4.7.2-2) (GCC)
> to do my builds these days...
> 
> steved.
> 
>> 
>> ---
>> 
>> Chuck Lever (10):
>>      rpc.gssd: Squelch compiler error
>>      rpc.gssd: Squelch compiler warning
>>      rpc.gssd: Squelch compiler warning
>>      mountd: Avoid unnecessary type conversions
>>      mountd: Avoid unnecessary type conversions
>>      mountd: Avoid unnecessary type conversions
>>      mountd: Make local functions static
>>      mountd: Eliminate unnecessary type conversions
>>      mountd: Avoid unnecessary type conversions
>>      nfs-utils: Eliminate dereferencing type punned pointers
>> 
>> 
>> support/include/nfslib.h   |    1 +
>> support/include/sockaddr.h |   10 ++++------
>> support/nfs/cacheio.c      |    5 +++++
>> utils/gssd/gss_util.c      |    2 +-
>> utils/gssd/gssd_proc.c     |   13 +++++++------
>> utils/mountd/cache.c       |   34 ++++++++++++++++++----------------
>> 6 files changed, 36 insertions(+), 29 deletions(-)
>> 

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 00/10] nfs-utils compiler warning clean ups
  2012-10-22 16:05 [PATCH 00/10] nfs-utils compiler warning clean ups Chuck Lever
                   ` (10 preceding siblings ...)
  2012-10-22 17:27 ` [PATCH 00/10] nfs-utils compiler warning clean ups Steve Dickson
@ 2012-10-30 19:36 ` Steve Dickson
  11 siblings, 0 replies; 14+ messages in thread
From: Steve Dickson @ 2012-10-30 19:36 UTC (permalink / raw)
  To: Chuck Lever; +Cc: linux-nfs



On 22/10/12 12:05, Chuck Lever wrote:
> Hi-
> 
> These address compiler warnings in mountd and gssd that I've found
> during recent sojourns in that code base.  I've done some light
> testing, but more critical review and testing would be appreciated.
> 
> I think these are appropriate for your next release of nfs-utils.
> 
> ---
> 
> Chuck Lever (10):
>       rpc.gssd: Squelch compiler error
>       rpc.gssd: Squelch compiler warning
>       rpc.gssd: Squelch compiler warning
>       mountd: Avoid unnecessary type conversions
>       mountd: Avoid unnecessary type conversions
>       mountd: Avoid unnecessary type conversions
>       mountd: Make local functions static
>       mountd: Eliminate unnecessary type conversions
>       mountd: Avoid unnecessary type conversions
>       nfs-utils: Eliminate dereferencing type punned pointers
> 
> 
>  support/include/nfslib.h   |    1 +
>  support/include/sockaddr.h |   10 ++++------
>  support/nfs/cacheio.c      |    5 +++++
>  utils/gssd/gss_util.c      |    2 +-
>  utils/gssd/gssd_proc.c     |   13 +++++++------
>  utils/mountd/cache.c       |   34 ++++++++++++++++++----------------
>  6 files changed, 36 insertions(+), 29 deletions(-)
> 
All 10 patches have been committed...

steved.

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2012-10-30 19:36 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-22 16:05 [PATCH 00/10] nfs-utils compiler warning clean ups Chuck Lever
2012-10-22 16:05 ` [PATCH 01/10] nfs-utils: Eliminate dereferencing type punned pointers Chuck Lever
2012-10-22 16:05 ` [PATCH 02/10] mountd: Avoid unnecessary type conversions Chuck Lever
2012-10-22 16:06 ` [PATCH 03/10] mountd: Eliminate " Chuck Lever
2012-10-22 16:06 ` [PATCH 04/10] mountd: Make local functions static Chuck Lever
2012-10-22 16:06 ` [PATCH 05/10] mountd: Avoid unnecessary type conversions Chuck Lever
2012-10-22 16:06 ` [PATCH 06/10] " Chuck Lever
2012-10-22 16:06 ` [PATCH 07/10] " Chuck Lever
2012-10-22 16:06 ` [PATCH 08/10] rpc.gssd: Squelch compiler warning Chuck Lever
2012-10-22 16:07 ` [PATCH 09/10] " Chuck Lever
2012-10-22 16:07 ` [PATCH 10/10] rpc.gssd: Squelch compiler error Chuck Lever
2012-10-22 17:27 ` [PATCH 00/10] nfs-utils compiler warning clean ups Steve Dickson
2012-10-22 17:31   ` Chuck Lever
2012-10-30 19:36 ` Steve Dickson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).