linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] Removed more warnings that now errors via -W
@ 2018-06-04 14:50 Steve Dickson
  2018-06-04 14:50 ` [PATCH 1/4] xtab.c: Removed overflow in implicit constant conversion errors Steve Dickson
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Steve Dickson @ 2018-06-04 14:50 UTC (permalink / raw)
  To: Linux NFS Mailing list

The patches remove more warnings that are errors via the -W flags. 
Basically allows RHEL7 to compile with following flags:

-Wformat=2 -Wmissing-include-dirs \
-Wunused -Wlogical-op \
-Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes \
-Wmissing-noreturn -Wshadow \
-Wunreachable-code -Wdisabled-optimization \
-fstrict-aliasing -fstrict-overflow \
-fexceptions -fstack-protector \
-fasynchronous-unwind-tables -fpie" \

There are still warnings but there are no more fatel errors. 


Steve Dickson (4):
  xtab.c: Removed overflow in implicit constant conversion errors
  Removed ISO C does not support the '%m' gnu_printf format errors
  Removed format expects argument of type errors
  gssd.c: Remomved a couple of warning errors

 support/include/exportfs.h |  2 +-
 utils/gssd/gssd.c          | 20 ++++++++++----------
 utils/idmapd/idmapd.c      |  3 ++-
 utils/nfsidmap/nfsidmap.c  |  2 +-
 utils/nfsstat/nfsstat.c    |  6 +++---
 utils/statd/statd.c        |  7 ++++---
 6 files changed, 21 insertions(+), 19 deletions(-)

-- 
1.8.3.1


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

* [PATCH 1/4] xtab.c: Removed overflow in implicit constant conversion errors
  2018-06-04 14:50 [PATCH 0/4] Removed more warnings that now errors via -W Steve Dickson
@ 2018-06-04 14:50 ` Steve Dickson
  2018-06-04 15:03   ` Chuck Lever
  2018-06-04 14:50 ` [PATCH 2/4] Removed ISO C does not support the '%m' gnu_printf format errors Steve Dickson
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 7+ messages in thread
From: Steve Dickson @ 2018-06-04 14:50 UTC (permalink / raw)
  To: Linux NFS Mailing list

xtab.c: In function 'xtab_read':
xtab.c:60:4: error: overflow in implicit constant conversion
[-Werror=overflow]
    exp->m_xtabent = 1;
    ^
xtab.c:61:4: error: overflow in implicit constant conversion
[-Werror=overflow]
    exp->m_mayexport = 1;

Signed-off-by: Steve Dickson <steved@redhat.com>
---
 support/include/exportfs.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/support/include/exportfs.h b/support/include/exportfs.h
index 8af47a8..a82a9b8 100644
--- a/support/include/exportfs.h
+++ b/support/include/exportfs.h
@@ -97,7 +97,7 @@ typedef struct mexport {
 	struct mclient *	m_client;
 	struct exportent	m_export;
 	int			m_exported;	/* known to knfsd. */
-	int			m_xtabent  : 1,	/* xtab entry exists */
+	unsigned int m_xtabent : 1,	/* xtab entry exists */
 				m_mayexport: 1,	/* derived from xtabbed */
 				m_changed  : 1, /* options (may) have changed */
 				m_warned   : 1; /* warned about multiple exports
-- 
1.8.3.1


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

* [PATCH 2/4] Removed ISO C does not support the '%m' gnu_printf format errors
  2018-06-04 14:50 [PATCH 0/4] Removed more warnings that now errors via -W Steve Dickson
  2018-06-04 14:50 ` [PATCH 1/4] xtab.c: Removed overflow in implicit constant conversion errors Steve Dickson
@ 2018-06-04 14:50 ` Steve Dickson
  2018-06-04 14:50 ` [PATCH 3/4] Removed format expects argument of type errors Steve Dickson
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Steve Dickson @ 2018-06-04 14:50 UTC (permalink / raw)
  To: Linux NFS Mailing list

nfsstat.c: In function 'mounts':
nfsstat.c:1016:3: error: ISO C does not support the '%m' gnu_printf
format [-Werror=format=]
   fprintf(stderr, "Warning: %s: %m\n", name);
   ^
nfsstat.c: In function 'get_stats':
nfsstat.c:1093:6: error: ISO C does not support the '%m' gnu_printf
format [-Werror=format=]
      label, file);

statd.c: In function 'set_nlm_port':
statd.c:235:5: error: ISO C does not support the '%m' gnu_printf format
[-Werror=format=]
     name_p, type);
     ^
statd.c:238:3: error: ISO C does not support the '%m' gnu_printf format
[-Werror=format=]
   fprintf(stderr, "%s: failed to open %s: %m\n", name_p, pathbuf);

Signed-off-by: Steve Dickson <steved@redhat.com>
---
 utils/nfsstat/nfsstat.c | 6 +++---
 utils/statd/statd.c     | 7 ++++---
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/utils/nfsstat/nfsstat.c b/utils/nfsstat/nfsstat.c
index c779053..8fccea7 100644
--- a/utils/nfsstat/nfsstat.c
+++ b/utils/nfsstat/nfsstat.c
@@ -1013,7 +1013,7 @@ mounts(const char *name)
 	 * be a fatal error -- it usually means the module isn't loaded.
 	 */
 	if ((fp = fopen(name, "r")) == NULL) {
-		fprintf(stderr, "Warning: %s: %m\n", name);
+		fprintf(stderr, "Warning: %s: %s\n", name, strerror(errno));
 		return 0;
 	}
 
@@ -1089,8 +1089,8 @@ out:
 		fclose(fp);
 	if (err) {
 		if (!other_opt) {
-			fprintf(stderr, "Error: No %s Stats (%s: %m). \n",
-					label, file);
+			fprintf(stderr, "Error: No %s Stats (%s: %s). \n",
+					label, file, strerror(errno));
 			exit(2);
 		}
 		*opt = 0;
diff --git a/utils/statd/statd.c b/utils/statd/statd.c
index 563a272..2cc6cf3 100644
--- a/utils/statd/statd.c
+++ b/utils/statd/statd.c
@@ -231,11 +231,12 @@ static void set_nlm_port(char *type, int port)
 	}
 	if (fd >= 0) {
 		if (write(fd, nbuf, strlen(nbuf)) != (ssize_t)strlen(nbuf))
-			fprintf(stderr, "%s: fail to set NLM %s port: %m\n",
-				name_p, type);
+			fprintf(stderr, "%s: fail to set NLM %s port: %s\n",
+				name_p, type, strerror(errno));
 		close(fd);
 	} else
-		fprintf(stderr, "%s: failed to open %s: %m\n", name_p, pathbuf);
+		fprintf(stderr, "%s: failed to open %s: %s\n", 
+			name_p, pathbuf, strerror(errno));
 }
 
 /*
-- 
1.8.3.1


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

* [PATCH 3/4] Removed format expects argument of type errors
  2018-06-04 14:50 [PATCH 0/4] Removed more warnings that now errors via -W Steve Dickson
  2018-06-04 14:50 ` [PATCH 1/4] xtab.c: Removed overflow in implicit constant conversion errors Steve Dickson
  2018-06-04 14:50 ` [PATCH 2/4] Removed ISO C does not support the '%m' gnu_printf format errors Steve Dickson
@ 2018-06-04 14:50 ` Steve Dickson
  2018-06-04 14:50 ` [PATCH 4/4] gssd.c: Remomved a couple of warning errors Steve Dickson
  2018-06-05 17:21 ` [PATCH 0/4] Removed more warnings that now errors via -W Steve Dickson
  4 siblings, 0 replies; 7+ messages in thread
From: Steve Dickson @ 2018-06-04 14:50 UTC (permalink / raw)
  To: Linux NFS Mailing list

idmapd.c: In function 'getfield':
idmapd.c:936:4: error: format '%o' expects argument of type 'unsigned
int *', but argument 3 has type 'int *' [-Werror=format=]
    if ((n = sscanf(bp, "\\%03o", &val)) != 1)

nfsidmap.c: In function 'key_invalidate':
nfsidmap.c:322:3: error: format '%x' expects argument of type 'unsigned
int *', but argument 3 has type 'key_serial_t *' [-Werror=format=]
   sscanf(buf, "%x", &key);

Signed-off-by: Steve Dickson <steved@redhat.com>
---
 utils/idmapd/idmapd.c     | 3 ++-
 utils/nfsidmap/nfsidmap.c | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/utils/idmapd/idmapd.c b/utils/idmapd/idmapd.c
index b87c4dd..2585fb2 100644
--- a/utils/idmapd/idmapd.c
+++ b/utils/idmapd/idmapd.c
@@ -923,7 +923,8 @@ static int
 getfield(char **bpp, char *fld, size_t fldsz)
 {
 	char *bp;
-	int val, n;
+	unsigned int val; 
+	int n;
 
 	while ((bp = strsep(bpp, " ")) != NULL && bp[0] == '\0')
 		;
diff --git a/utils/nfsidmap/nfsidmap.c b/utils/nfsidmap/nfsidmap.c
index 374bc5d..d3967a3 100644
--- a/utils/nfsidmap/nfsidmap.c
+++ b/utils/nfsidmap/nfsidmap.c
@@ -283,7 +283,7 @@ static int key_invalidate(char *keystr, int keymask)
 {
 	FILE *fp;
 	char buf[BUFSIZ], *ptr;
-	key_serial_t key;
+	unsigned int key;
 	int mask;
 
 	xlog_syslog(0);
-- 
1.8.3.1


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

* [PATCH 4/4] gssd.c: Remomved a couple of warning errors
  2018-06-04 14:50 [PATCH 0/4] Removed more warnings that now errors via -W Steve Dickson
                   ` (2 preceding siblings ...)
  2018-06-04 14:50 ` [PATCH 3/4] Removed format expects argument of type errors Steve Dickson
@ 2018-06-04 14:50 ` Steve Dickson
  2018-06-05 17:21 ` [PATCH 0/4] Removed more warnings that now errors via -W Steve Dickson
  4 siblings, 0 replies; 7+ messages in thread
From: Steve Dickson @ 2018-06-04 14:50 UTC (permalink / raw)
  To: Linux NFS Mailing list

gssd.c:291:7: error: ISO C does not support the 'm' scanf flag
[-Werror=format=]

gssd.c:291:7: error: format '%s' expects argument of type 'char *', but
argument 4 has type 'char **' [-Werror=format=]

Signed-off-by: Steve Dickson <steved@redhat.com>
---
 utils/gssd/gssd.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/utils/gssd/gssd.c b/utils/gssd/gssd.c
index 2c14e5f..7b21ee2 100644
--- a/utils/gssd/gssd.c
+++ b/utils/gssd/gssd.c
@@ -279,16 +279,16 @@ gssd_read_service_info(int dirfd, struct clnt_info *clp)
 	 * (commit bf19aacecbeebccb2c3d150a8bd9416b7dba81fe)
 	 */
 	numfields = fscanf(info,
-			   "RPC server: %ms\n"
-			   "service: %ms (%d) version %d\n"
-			   "address: %ms\n"
-			   "protocol: %ms\n"
-			   "port: %ms\n",
-			   &server,
-			   &service, &program, &version,
-			   &address,
-			   &protoname,
-			   &port);
+			   "RPC server: %s\n"
+			   "service: %s (%d) version %d\n"
+			   "address: %s\n"
+			   "protocol: %s\n"
+			   "port: %s\n",
+			   (char *)&server,
+			   (char *)&service, &program, &version,
+			   (char *)&address,
+			   (char *)&protoname,
+			   (char *)&port);
 
 
 	switch (numfields) {
-- 
1.8.3.1


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

* Re: [PATCH 1/4] xtab.c: Removed overflow in implicit constant conversion errors
  2018-06-04 14:50 ` [PATCH 1/4] xtab.c: Removed overflow in implicit constant conversion errors Steve Dickson
@ 2018-06-04 15:03   ` Chuck Lever
  0 siblings, 0 replies; 7+ messages in thread
From: Chuck Lever @ 2018-06-04 15:03 UTC (permalink / raw)
  To: Steve Dickson; +Cc: Linux NFS Mailing List



> On Jun 4, 2018, at 10:50 AM, Steve Dickson <steved@redhat.com> wrote:
>=20
> xtab.c: In function 'xtab_read':
> xtab.c:60:4: error: overflow in implicit constant conversion
> [-Werror=3Doverflow]
>    exp->m_xtabent =3D 1;
>    ^
> xtab.c:61:4: error: overflow in implicit constant conversion
> [-Werror=3Doverflow]
>    exp->m_mayexport =3D 1;
>=20
> Signed-off-by: Steve Dickson <steved@redhat.com>
> ---
> support/include/exportfs.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>=20
> diff --git a/support/include/exportfs.h b/support/include/exportfs.h
> index 8af47a8..a82a9b8 100644
> --- a/support/include/exportfs.h
> +++ b/support/include/exportfs.h
> @@ -97,7 +97,7 @@ typedef struct mexport {
> 	struct mclient *	m_client;
> 	struct exportent	m_export;
> 	int			m_exported;	/* known to knfsd. */
> -	int			m_xtabent  : 1,	/* xtab entry exists */
> +	unsigned int m_xtabent : 1,	/* xtab entry exists */

Nit: White space damage. "m_xtabent" and the colon should line up with =
the following fields.

Overall these look like all the errors I hit. Thanks for the fixes!


> 				m_mayexport: 1,	/* derived from xtabbed =
*/
> 				m_changed  : 1, /* options (may) have =
changed */
> 				m_warned   : 1; /* warned about multiple =
exports
> --=20
> 1.8.3.1
>=20
> --
> To unsubscribe from this list: send the line "unsubscribe linux-nfs" =
in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
Chuck Lever




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

* Re: [PATCH 0/4] Removed more warnings that now errors via -W
  2018-06-04 14:50 [PATCH 0/4] Removed more warnings that now errors via -W Steve Dickson
                   ` (3 preceding siblings ...)
  2018-06-04 14:50 ` [PATCH 4/4] gssd.c: Remomved a couple of warning errors Steve Dickson
@ 2018-06-05 17:21 ` Steve Dickson
  4 siblings, 0 replies; 7+ messages in thread
From: Steve Dickson @ 2018-06-05 17:21 UTC (permalink / raw)
  To: Linux NFS Mailing list



On 06/04/2018 10:50 AM, Steve Dickson wrote:
> The patches remove more warnings that are errors via the -W flags. 
> Basically allows RHEL7 to compile with following flags:
> 
> -Wformat=2 -Wmissing-include-dirs \
> -Wunused -Wlogical-op \
> -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes \
> -Wmissing-noreturn -Wshadow \
> -Wunreachable-code -Wdisabled-optimization \
> -fstrict-aliasing -fstrict-overflow \
> -fexceptions -fstack-protector \
> -fasynchronous-unwind-tables -fpie" \
> 
> There are still warnings but there are no more fatel errors. 
> 
> 
> Steve Dickson (4):
>   xtab.c: Removed overflow in implicit constant conversion errors
>   Removed ISO C does not support the '%m' gnu_printf format errors
>   Removed format expects argument of type errors
>   gssd.c: Remomved a couple of warning errors
> 
>  support/include/exportfs.h |  2 +-
>  utils/gssd/gssd.c          | 20 ++++++++++----------
>  utils/idmapd/idmapd.c      |  3 ++-
>  utils/nfsidmap/nfsidmap.c  |  2 +-
>  utils/nfsstat/nfsstat.c    |  6 +++---
>  utils/statd/statd.c        |  7 ++++---
>  6 files changed, 21 insertions(+), 19 deletions(-)
> 
Committed... with the nit fixed.

steved.

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

end of thread, other threads:[~2018-06-05 17:21 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-04 14:50 [PATCH 0/4] Removed more warnings that now errors via -W Steve Dickson
2018-06-04 14:50 ` [PATCH 1/4] xtab.c: Removed overflow in implicit constant conversion errors Steve Dickson
2018-06-04 15:03   ` Chuck Lever
2018-06-04 14:50 ` [PATCH 2/4] Removed ISO C does not support the '%m' gnu_printf format errors Steve Dickson
2018-06-04 14:50 ` [PATCH 3/4] Removed format expects argument of type errors Steve Dickson
2018-06-04 14:50 ` [PATCH 4/4] gssd.c: Remomved a couple of warning errors Steve Dickson
2018-06-05 17:21 ` [PATCH 0/4] Removed more warnings that now errors via -W 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).