2017-07-19 20:53:56

by Steve Dickson

[permalink] [raw]
Subject: [PATCH 00/11] Removed a bunch random warnings

I upgraded to Fedora 26 and went to apply Neil's
recent mount patches and ended up seeing all
these warning.

These patches fix those warnings

Steve Dickson (11):
rpcdebug.c: remove a warning
present_address: remove a warning
atomicio: removed a warning
cache.c: removed a couple warning
nfsd.c: removed a few warnings
bldev_read_serial: removed a couple warnings
device-discovery.c: removed a warning
network.c: removed some warnings
nfsmount: remove a warning
nfs4mount: removed a warning
nfsdcltrack.c: remove a warning

support/misc/tcpwrapper.c | 1 +
support/nfs/atomicio.c | 1 +
tools/rpcdebug/rpcdebug.c | 3 ++-
utils/blkmapd/device-discovery.c | 1 +
utils/blkmapd/device-inq.c | 2 ++
utils/mount/network.c | 5 +++++
utils/mount/nfs4mount.c | 1 +
utils/mount/nfsmount.c | 1 +
utils/mountd/cache.c | 1 +
utils/nfsd/nfsd.c | 5 ++++-
utils/nfsdcltrack/nfsdcltrack.c | 1 +
11 files changed, 20 insertions(+), 2 deletions(-)

--
2.13.3



2017-07-19 20:53:57

by Steve Dickson

[permalink] [raw]
Subject: [PATCH 01/11] rpcdebug.c: remove a warning

rpcdebug.c:77:4: warning: this statement may fall through [-Wimplicit-fallthrough=]

Signed-off-by: Steve Dickson <[email protected]>
---
tools/rpcdebug/rpcdebug.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/rpcdebug/rpcdebug.c b/tools/rpcdebug/rpcdebug.c
index 18b1622..68206cc 100644
--- a/tools/rpcdebug/rpcdebug.c
+++ b/tools/rpcdebug/rpcdebug.c
@@ -74,7 +74,8 @@ main(int argc, char **argv)
opt_c = 1;
break;
case 'h':
- usage(0, module);
+ usage(0, module); /* usage does not return */
+ break;
case 'm':
module = optarg;
break;
--
2.13.3


2017-07-19 20:53:57

by Steve Dickson

[permalink] [raw]
Subject: [PATCH 02/11] present_address: remove a warning

tcpwrapper.c:73:6: warning: this statement may fall through [-Wimplicit-fallthrough=]

Signed-off-by: Steve Dickson <[email protected]>
---
support/misc/tcpwrapper.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/support/misc/tcpwrapper.c b/support/misc/tcpwrapper.c
index 06b0a46..3128053 100644
--- a/support/misc/tcpwrapper.c
+++ b/support/misc/tcpwrapper.c
@@ -72,6 +72,7 @@ present_address(const struct sockaddr *sap, char *buf, const size_t buflen)
case AF_INET:
if (inet_ntop(AF_INET, &sin->sin_addr, buf, len) != 0)
return;
+ break;
case AF_INET6:
if (inet_ntop(AF_INET6, &sin6->sin6_addr, buf, len) != 0)
return;
--
2.13.3


2017-07-19 20:54:01

by Steve Dickson

[permalink] [raw]
Subject: [PATCH 10/11] nfs4mount: removed a warning

nfs4mount.c:445:8: warning: this statement may fall through [-Wimplicit-fallthrough=]

Signed-off-by: Steve Dickson <[email protected]>
---
utils/mount/nfs4mount.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/utils/mount/nfs4mount.c b/utils/mount/nfs4mount.c
index 028e7cd..89629ed 100644
--- a/utils/mount/nfs4mount.c
+++ b/utils/mount/nfs4mount.c
@@ -444,6 +444,7 @@ int nfs4mount(const char *spec, const char *node, int flags,
case RPC_SYSTEMERROR:
if (errno == ETIMEDOUT)
break;
+ /* FALLTHRU */
default:
rpc_mount_errors(hostname, 0, bg);
goto fail;
--
2.13.3


2017-07-19 20:53:59

by Steve Dickson

[permalink] [raw]
Subject: [PATCH 04/11] cache.c: removed a couple warning

cache.c:623:13: warning: In the GNU C Library, "major" is defined
by <sys/sysmacros.h>. For historical compatibility, it is
currently defined by <sys/types.h> as well, but we plan to
remove this soon. To use "major", include <sys/sysmacros.h>
directly. If you did not intend to use a system-defined macro
"major", you should undefine it after including <sys/types.h>.
if (parsed->major != major(stb.st_dev) ||
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

cache.c:624:13: warning: In the GNU C Library, "minor" is defined
by <sys/sysmacros.h>. For historical compatibility, it is
currently defined by <sys/types.h> as well, but we plan to
remove this soon. To use "minor", include <sys/sysmacros.h>
directly. If you did not intend to use a system-defined macro
"minor", you should undefine it after including <sys/types.h>.
parsed->minor != minor(stb.st_dev))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Steve Dickson <[email protected]>
---
utils/mountd/cache.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/utils/mountd/cache.c b/utils/mountd/cache.c
index ca6c84f..e49300d 100644
--- a/utils/mountd/cache.c
+++ b/utils/mountd/cache.c
@@ -11,6 +11,7 @@
#include <config.h>
#endif

+#include <sys/sysmacros.h>
#include <sys/types.h>
#include <sys/select.h>
#include <sys/stat.h>
--
2.13.3


2017-07-19 20:53:58

by Steve Dickson

[permalink] [raw]
Subject: [PATCH 03/11] atomicio: removed a warning

atomicio.c:43:7: warning: this statement may fall through [-Wimplicit-fallthrough=]

Signed-off-by: Steve Dickson <[email protected]>
---
support/nfs/atomicio.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/support/nfs/atomicio.c b/support/nfs/atomicio.c
index 5e760e6..0234072 100644
--- a/support/nfs/atomicio.c
+++ b/support/nfs/atomicio.c
@@ -42,6 +42,7 @@ ssize_t atomicio(ssize_t(*f) (int, void *, size_t), int fd, void *_s, size_t n)
case -1:
if (errno == EINTR || errno == EAGAIN)
continue;
+ break;
case 0:
if (pos != 0)
return pos;
--
2.13.3


2017-07-19 20:53:59

by Steve Dickson

[permalink] [raw]
Subject: [PATCH 05/11] nfsd.c: removed a few warnings

nfsd.c:187:8: warning: this statement may fall through [-Wimplicit-fallthrough=]
nfsd.c:213:8: warning: this statement may fall through [-Wimplicit-fallthrough=]nfsd.c:263:4: warning: this statement may fall through [-Wimplicit-fallthrough=]

Signed-off-by: Steve Dickson <[email protected]>
---
utils/nfsd/nfsd.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/utils/nfsd/nfsd.c b/utils/nfsd/nfsd.c
index 2b38249..1d35658 100644
--- a/utils/nfsd/nfsd.c
+++ b/utils/nfsd/nfsd.c
@@ -198,6 +198,7 @@ main(int argc, char **argv)
minorvers = 0;
minorversset = minormask;
}
+ break;
case 3:
case 2:
NFSCTL_VERUNSET(versbits, c);
@@ -220,6 +221,7 @@ main(int argc, char **argv)
NFSCTL_MINORSET(minorvers, i);
} else
minorvers = minorversset = minormask;
+ break;
case 3:
case 2:
NFSCTL_VERSET(versbits, c);
@@ -261,8 +263,9 @@ main(int argc, char **argv)
break;
default:
fprintf(stderr, "Invalid argument: '%c'\n", c);
+ /* FALLTHRU */
case 'h':
- usage(progname);
+ usage(progname); /* usage does not return */
}
}

--
2.13.3


2017-07-19 20:54:00

by Steve Dickson

[permalink] [raw]
Subject: [PATCH 08/11] network.c: removed some warnings

network.c:1234:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
network.c:1382:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
network.c:1477:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
network.c:1508:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
network.c:1574:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
Signed-off-by: Steve Dickson <[email protected]>
---
utils/mount/network.c | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/utils/mount/network.c b/utils/mount/network.c
index 281e935..19f14e5 100644
--- a/utils/mount/network.c
+++ b/utils/mount/network.c
@@ -1235,6 +1235,7 @@ nfs_nfs_program(struct mount_options *options, unsigned long *program)
*program = tmp;
return 1;
}
+ break;
case PO_BAD_VALUE:
nfs_error(_("%s: invalid value for 'nfsprog=' option"),
progname);
@@ -1383,6 +1384,7 @@ nfs_nfs_port(struct mount_options *options, unsigned long *port)
*port = tmp;
return 1;
}
+ break;
case PO_BAD_VALUE:
nfs_error(_("%s: invalid value for 'port=' option"),
progname);
@@ -1478,6 +1480,7 @@ nfs_mount_program(struct mount_options *options, unsigned long *program)
*program = tmp;
return 1;
}
+ break;
case PO_BAD_VALUE:
nfs_error(_("%s: invalid value for 'mountprog=' option"),
progname);
@@ -1509,6 +1512,7 @@ nfs_mount_version(struct mount_options *options, unsigned long *version)
*version = tmp;
return 1;
}
+ break;
case PO_BAD_VALUE:
nfs_error(_("%s: invalid value for 'mountvers=' option"),
progname);
@@ -1575,6 +1579,7 @@ nfs_mount_port(struct mount_options *options, unsigned long *port)
*port = tmp;
return 1;
}
+ break;
case PO_BAD_VALUE:
nfs_error(_("%s: invalid value for 'mountport=' option"),
progname);
--
2.13.3


2017-07-19 20:54:00

by Steve Dickson

[permalink] [raw]
Subject: [PATCH 07/11] device-discovery.c: removed a warning

device-discovery.c:171:13: warning: In the GNU C Library, "major" is defined
by <sys/sysmacros.h>. For historical compatibility, it is
currently defined by <sys/types.h> as well, but we plan to
remove this soon. To use "major", include <sys/sysmacros.h>
directly. If you did not intend to use a system-defined macro
"major", you should undefine it after including <sys/types.h>.
} else if (dm_is_dm_major(major(dev)))
^~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Steve Dickson <[email protected]>
---
utils/blkmapd/device-discovery.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/utils/blkmapd/device-discovery.c b/utils/blkmapd/device-discovery.c
index c66669d..29bafb2 100644
--- a/utils/blkmapd/device-discovery.c
+++ b/utils/blkmapd/device-discovery.c
@@ -26,6 +26,7 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

+#include <sys/sysmacros.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
--
2.13.3


2017-07-19 20:54:01

by Steve Dickson

[permalink] [raw]
Subject: [PATCH 11/11] nfsdcltrack.c: remove a warning

nfsdcltrack.c:581:4: warning: this statement may fall through [-Wimplicit-fallthrough=]

Signed-off-by: Steve Dickson <[email protected]>
---
utils/nfsdcltrack/nfsdcltrack.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/utils/nfsdcltrack/nfsdcltrack.c b/utils/nfsdcltrack/nfsdcltrack.c
index 124c923..0baaa3e 100644
--- a/utils/nfsdcltrack/nfsdcltrack.c
+++ b/utils/nfsdcltrack/nfsdcltrack.c
@@ -579,6 +579,7 @@ main(int argc, char **argv)
switch (arg) {
case 'd':
xlog_config(D_ALL, 1);
+ break;
case 'f':
xlog_syslog(0);
xlog_stderr(1);
--
2.13.3


2017-07-19 20:53:59

by Steve Dickson

[permalink] [raw]
Subject: [PATCH 06/11] bldev_read_serial: removed a couple warnings

device-inq.c:216:7: warning: this statement may fall through [-Wimplicit-fallthrough=]
device-inq.c:223:7: warning: this statement may fall through [-Wimplicit-fallthrough=]

Signed-off-by: Steve Dickson <[email protected]>
---
utils/blkmapd/device-inq.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/utils/blkmapd/device-inq.c b/utils/blkmapd/device-inq.c
index 0062a8f..c7952c3 100644
--- a/utils/blkmapd/device-inq.c
+++ b/utils/blkmapd/device-inq.c
@@ -216,6 +216,7 @@ struct bl_serial *bldev_read_serial(int fd, const char *filename)
if ((dev_id->len != 8) && (dev_id->len != 12) &&
(dev_id->len != 16))
break;
+ /* FALLTHRU */
case 3: /* NAA */
/* TODO: NAA validity judgement too complicated,
* so just ingore it here.
@@ -224,6 +225,7 @@ struct bl_serial *bldev_read_serial(int fd, const char *filename)
BL_LOG_ERR("Binary code_set expected\n");
break;
}
+ /* FALLTHRU */
case 0: /* vendor specific */
case 1: /* T10 vendor identification */
current_id = dev_id->ids & 0xf;
--
2.13.3


2017-07-19 20:54:00

by Steve Dickson

[permalink] [raw]
Subject: [PATCH 09/11] nfsmount: remove a warning

nfsmount.c:684:8: warning: this statement may fall through [-Wimplicit-fallthrough=]

Signed-off-by: Steve Dickson <[email protected]>
---
utils/mount/nfsmount.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/utils/mount/nfsmount.c b/utils/mount/nfsmount.c
index 930622d..ae4a3da 100644
--- a/utils/mount/nfsmount.c
+++ b/utils/mount/nfsmount.c
@@ -683,6 +683,7 @@ nfsmount(const char *spec, const char *node, int flags,
case RPC_SYSTEMERROR:
if (errno == ETIMEDOUT)
break;
+ /* FALLTHRU */
default:
rpc_mount_errors(*nfs_server.hostname, 0, bg);
goto fail;
--
2.13.3


2017-07-20 10:32:48

by Jeff Layton

[permalink] [raw]
Subject: Re: [PATCH 11/11] nfsdcltrack.c: remove a warning

On Wed, 2017-07-19 at 16:53 -0400, Steve Dickson wrote:
> nfsdcltrack.c:581:4: warning: this statement may fall through [-Wimplicit-fallthrough=]
>
> Signed-off-by: Steve Dickson <[email protected]>
> ---
> utils/nfsdcltrack/nfsdcltrack.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/utils/nfsdcltrack/nfsdcltrack.c b/utils/nfsdcltrack/nfsdcltrack.c
> index 124c923..0baaa3e 100644
> --- a/utils/nfsdcltrack/nfsdcltrack.c
> +++ b/utils/nfsdcltrack/nfsdcltrack.c
> @@ -579,6 +579,7 @@ main(int argc, char **argv)
> switch (arg) {
> case 'd':
> xlog_config(D_ALL, 1);
> + break;
> case 'f':
> xlog_syslog(0);
> xlog_stderr(1);

Acked-by: Jeff Layton <[email protected]>

2017-07-20 18:24:04

by J. Bruce Fields

[permalink] [raw]
Subject: Re: [PATCH 03/11] atomicio: removed a warning

On Wed, Jul 19, 2017 at 04:53:46PM -0400, Steve Dickson wrote:
> atomicio.c:43:7: warning: this statement may fall through [-Wimplicit-fallthrough=]

I think this is wrong. For example, if we don't have permission to do
the IO, this causes atomicio() to return 0 instead of -1.

--b.

>
> Signed-off-by: Steve Dickson <[email protected]>
> ---
> support/nfs/atomicio.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/support/nfs/atomicio.c b/support/nfs/atomicio.c
> index 5e760e6..0234072 100644
> --- a/support/nfs/atomicio.c
> +++ b/support/nfs/atomicio.c
> @@ -42,6 +42,7 @@ ssize_t atomicio(ssize_t(*f) (int, void *, size_t), int fd, void *_s, size_t n)
> case -1:
> if (errno == EINTR || errno == EAGAIN)
> continue;
> + break;
> case 0:
> if (pos != 0)
> return pos;
> --
> 2.13.3
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html

2017-07-20 18:28:24

by J. Bruce Fields

[permalink] [raw]
Subject: Re: [PATCH 05/11] nfsd.c: removed a few warnings

On Wed, Jul 19, 2017 at 04:53:48PM -0400, Steve Dickson wrote:
> nfsd.c:187:8: warning: this statement may fall through [-Wimplicit-fallthrough=]
> nfsd.c:213:8: warning: this statement may fall through [-Wimplicit-fallthrough=]nfsd.c:263:4: warning: this statement may fall through [-Wimplicit-fallthrough=]

Are you sure about this? It looks to me like the fall through was
intended in the -N4 and -V4 cases.

--b.

>
> Signed-off-by: Steve Dickson <[email protected]>
> ---
> utils/nfsd/nfsd.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/utils/nfsd/nfsd.c b/utils/nfsd/nfsd.c
> index 2b38249..1d35658 100644
> --- a/utils/nfsd/nfsd.c
> +++ b/utils/nfsd/nfsd.c
> @@ -198,6 +198,7 @@ main(int argc, char **argv)
> minorvers = 0;
> minorversset = minormask;
> }
> + break;
> case 3:
> case 2:
> NFSCTL_VERUNSET(versbits, c);
> @@ -220,6 +221,7 @@ main(int argc, char **argv)
> NFSCTL_MINORSET(minorvers, i);
> } else
> minorvers = minorversset = minormask;
> + break;
> case 3:
> case 2:
> NFSCTL_VERSET(versbits, c);
> @@ -261,8 +263,9 @@ main(int argc, char **argv)
> break;
> default:
> fprintf(stderr, "Invalid argument: '%c'\n", c);
> + /* FALLTHRU */
> case 'h':
> - usage(progname);
> + usage(progname); /* usage does not return */
> }
> }
>
> --
> 2.13.3
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html

2017-07-20 18:37:59

by J. Bruce Fields

[permalink] [raw]
Subject: Re: [PATCH 08/11] network.c: removed some warnings

On Wed, Jul 19, 2017 at 04:53:51PM -0400, Steve Dickson wrote:
> network.c:1234:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
> network.c:1382:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
> network.c:1477:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
> network.c:1508:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
> network.c:1574:6: warning: this statement may fall through [-Wimplicit-fallthrough=]

Looks like after this an out-of-range port number will be treated as an
unspecified port rather than returning an error. That sounds wrong.

I didn't check the others.

All of these "break" statements added without any explanation are making
me nervous.

--b.

> Signed-off-by: Steve Dickson <[email protected]>
> ---
> utils/mount/network.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/utils/mount/network.c b/utils/mount/network.c
> index 281e935..19f14e5 100644
> --- a/utils/mount/network.c
> +++ b/utils/mount/network.c
> @@ -1235,6 +1235,7 @@ nfs_nfs_program(struct mount_options *options, unsigned long *program)
> *program = tmp;
> return 1;
> }
> + break;
> case PO_BAD_VALUE:
> nfs_error(_("%s: invalid value for 'nfsprog=' option"),
> progname);
> @@ -1383,6 +1384,7 @@ nfs_nfs_port(struct mount_options *options, unsigned long *port)
> *port = tmp;
> return 1;
> }
> + break;
> case PO_BAD_VALUE:
> nfs_error(_("%s: invalid value for 'port=' option"),
> progname);
> @@ -1478,6 +1480,7 @@ nfs_mount_program(struct mount_options *options, unsigned long *program)
> *program = tmp;
> return 1;
> }
> + break;
> case PO_BAD_VALUE:
> nfs_error(_("%s: invalid value for 'mountprog=' option"),
> progname);
> @@ -1509,6 +1512,7 @@ nfs_mount_version(struct mount_options *options, unsigned long *version)
> *version = tmp;
> return 1;
> }
> + break;
> case PO_BAD_VALUE:
> nfs_error(_("%s: invalid value for 'mountvers=' option"),
> progname);
> @@ -1575,6 +1579,7 @@ nfs_mount_port(struct mount_options *options, unsigned long *port)
> *port = tmp;
> return 1;
> }
> + break;
> case PO_BAD_VALUE:
> nfs_error(_("%s: invalid value for 'mountport=' option"),
> progname);
> --
> 2.13.3
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html

2017-07-20 18:42:44

by J. Bruce Fields

[permalink] [raw]
Subject: Re: [PATCH 02/11] present_address: remove a warning

On Wed, Jul 19, 2017 at 04:53:45PM -0400, Steve Dickson wrote:
> tcpwrapper.c:73:6: warning: this statement may fall through [-Wimplicit-fallthrough=]

This one looks like a real bugfix to me; could use a changelog.

--b.

>
> Signed-off-by: Steve Dickson <[email protected]>
> ---
> support/misc/tcpwrapper.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/support/misc/tcpwrapper.c b/support/misc/tcpwrapper.c
> index 06b0a46..3128053 100644
> --- a/support/misc/tcpwrapper.c
> +++ b/support/misc/tcpwrapper.c
> @@ -72,6 +72,7 @@ present_address(const struct sockaddr *sap, char *buf, const size_t buflen)
> case AF_INET:
> if (inet_ntop(AF_INET, &sin->sin_addr, buf, len) != 0)
> return;
> + break;
> case AF_INET6:
> if (inet_ntop(AF_INET6, &sin6->sin6_addr, buf, len) != 0)
> return;
> --
> 2.13.3
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html

2017-07-21 14:46:34

by Steve Dickson

[permalink] [raw]
Subject: Re: [PATCH 03/11] atomicio: removed a warning



On 07/20/2017 02:24 PM, J. Bruce Fields wrote:
> On Wed, Jul 19, 2017 at 04:53:46PM -0400, Steve Dickson wrote:
>> atomicio.c:43:7: warning: this statement may fall through [-Wimplicit-fallthrough=]
> I think this is wrong. For example, if we don't have permission to do
> the IO, this causes atomicio() to return 0 instead of -1.
I see your point... Nice catch!

steved.

2017-07-21 16:20:26

by Steve Dickson

[permalink] [raw]
Subject: Re: [PATCH 05/11] nfsd.c: removed a few warnings



On 07/20/2017 02:28 PM, J. Bruce Fields wrote:
> On Wed, Jul 19, 2017 at 04:53:48PM -0400, Steve Dickson wrote:
>> nfsd.c:187:8: warning: this statement may fall through [-Wimplicit-fallthrough=]
>> nfsd.c:213:8: warning: this statement may fall through [-Wimplicit-fallthrough=]nfsd.c:263:4: warning: this statement may fall through [-Wimplicit-fallthrough=]
>
> Are you sure about this? It looks to me like the fall through was
> intended in the -N4 and -V4 cases.
Wow... how un-obvious that! The -N4 actually does use the
NFSCTL_VERUNSET() in the 3,2 case... Talk about in needed
of a comment! ;-)

steved.

>
> --b.
>
>>
>> Signed-off-by: Steve Dickson <[email protected]>
>> ---
>> utils/nfsd/nfsd.c | 5 ++++-
>> 1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/utils/nfsd/nfsd.c b/utils/nfsd/nfsd.c
>> index 2b38249..1d35658 100644
>> --- a/utils/nfsd/nfsd.c
>> +++ b/utils/nfsd/nfsd.c
>> @@ -198,6 +198,7 @@ main(int argc, char **argv)
>> minorvers = 0;
>> minorversset = minormask;
>> }
>> + break;
>> case 3:
>> case 2:
>> NFSCTL_VERUNSET(versbits, c);
>> @@ -220,6 +221,7 @@ main(int argc, char **argv)
>> NFSCTL_MINORSET(minorvers, i);
>> } else
>> minorvers = minorversset = minormask;
>> + break;
>> case 3:
>> case 2:
>> NFSCTL_VERSET(versbits, c);
>> @@ -261,8 +263,9 @@ main(int argc, char **argv)
>> break;
>> default:
>> fprintf(stderr, "Invalid argument: '%c'\n", c);
>> + /* FALLTHRU */
>> case 'h':
>> - usage(progname);
>> + usage(progname); /* usage does not return */
>> }
>> }
>>
>> --
>> 2.13.3
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
>> the body of a message to [email protected]
>> More majordomo info at http://vger.kernel.org/majordomo-info.html

2017-07-21 16:29:14

by Steve Dickson

[permalink] [raw]
Subject: Re: [PATCH 08/11] network.c: removed some warnings



On 07/20/2017 02:37 PM, J. Bruce Fields wrote:
> On Wed, Jul 19, 2017 at 04:53:51PM -0400, Steve Dickson wrote:
>> network.c:1234:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
>> network.c:1382:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
>> network.c:1477:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
>> network.c:1508:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
>> network.c:1574:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
>
> Looks like after this an out-of-range port number will be treated as an
> unspecified port rather than returning an error. That sounds wrong.
>
> I didn't check the others.
>
> All of these "break" statements added without any explanation are making
> me nervous.
Yeah you are right... Boy there are some subtle things going there...

Thanks for the review and cycles!

steved.

>
> --b.
>
>> Signed-off-by: Steve Dickson <[email protected]>
>> ---
>> utils/mount/network.c | 5 +++++
>> 1 file changed, 5 insertions(+)
>>
>> diff --git a/utils/mount/network.c b/utils/mount/network.c
>> index 281e935..19f14e5 100644
>> --- a/utils/mount/network.c
>> +++ b/utils/mount/network.c
>> @@ -1235,6 +1235,7 @@ nfs_nfs_program(struct mount_options *options, unsigned long *program)
>> *program = tmp;
>> return 1;
>> }
>> + break;
>> case PO_BAD_VALUE:
>> nfs_error(_("%s: invalid value for 'nfsprog=' option"),
>> progname);
>> @@ -1383,6 +1384,7 @@ nfs_nfs_port(struct mount_options *options, unsigned long *port)
>> *port = tmp;
>> return 1;
>> }
>> + break;
>> case PO_BAD_VALUE:
>> nfs_error(_("%s: invalid value for 'port=' option"),
>> progname);
>> @@ -1478,6 +1480,7 @@ nfs_mount_program(struct mount_options *options, unsigned long *program)
>> *program = tmp;
>> return 1;
>> }
>> + break;
>> case PO_BAD_VALUE:
>> nfs_error(_("%s: invalid value for 'mountprog=' option"),
>> progname);
>> @@ -1509,6 +1512,7 @@ nfs_mount_version(struct mount_options *options, unsigned long *version)
>> *version = tmp;
>> return 1;
>> }
>> + break;
>> case PO_BAD_VALUE:
>> nfs_error(_("%s: invalid value for 'mountvers=' option"),
>> progname);
>> @@ -1575,6 +1579,7 @@ nfs_mount_port(struct mount_options *options, unsigned long *port)
>> *port = tmp;
>> return 1;
>> }
>> + break;
>> case PO_BAD_VALUE:
>> nfs_error(_("%s: invalid value for 'mountport=' option"),
>> progname);
>> --
>> 2.13.3
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
>> the body of a message to [email protected]
>> More majordomo info at http://vger.kernel.org/majordomo-info.html

2017-07-21 18:30:12

by J. Bruce Fields

[permalink] [raw]
Subject: Re: [PATCH 08/11] network.c: removed some warnings

On Fri, Jul 21, 2017 at 12:29:12PM -0400, Steve Dickson wrote:
>
>
> On 07/20/2017 02:37 PM, J. Bruce Fields wrote:
> > On Wed, Jul 19, 2017 at 04:53:51PM -0400, Steve Dickson wrote:
> >> network.c:1234:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
> >> network.c:1382:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
> >> network.c:1477:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
> >> network.c:1508:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
> >> network.c:1574:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
> >
> > Looks like after this an out-of-range port number will be treated as an
> > unspecified port rather than returning an error. That sounds wrong.
> >
> > I didn't check the others.
> >
> > All of these "break" statements added without any explanation are making
> > me nervous.
> Yeah you are right... Boy there are some subtle things going there...
>
> Thanks for the review and cycles!

If you respin these patches, it'd be helpful to either add a short
comment explaining why the fallthrough is correct, or if you add a
break, explain in the changelog why the old behavior was wrong and
whether there was an actual user-visible bug.

Totally understood if that's too much work to be worth it right now, but
then I'd rather let the warnings wait a little longer. If that makes it
hard to see real warnings, then we can turn off those compiler flags for
now. Quick fixes to shut up warnings can be as risky as missed
warnings.

--b.

>
> steved.
>
> >
> > --b.
> >
> >> Signed-off-by: Steve Dickson <[email protected]>
> >> ---
> >> utils/mount/network.c | 5 +++++
> >> 1 file changed, 5 insertions(+)
> >>
> >> diff --git a/utils/mount/network.c b/utils/mount/network.c
> >> index 281e935..19f14e5 100644
> >> --- a/utils/mount/network.c
> >> +++ b/utils/mount/network.c
> >> @@ -1235,6 +1235,7 @@ nfs_nfs_program(struct mount_options *options, unsigned long *program)
> >> *program = tmp;
> >> return 1;
> >> }
> >> + break;
> >> case PO_BAD_VALUE:
> >> nfs_error(_("%s: invalid value for 'nfsprog=' option"),
> >> progname);
> >> @@ -1383,6 +1384,7 @@ nfs_nfs_port(struct mount_options *options, unsigned long *port)
> >> *port = tmp;
> >> return 1;
> >> }
> >> + break;
> >> case PO_BAD_VALUE:
> >> nfs_error(_("%s: invalid value for 'port=' option"),
> >> progname);
> >> @@ -1478,6 +1480,7 @@ nfs_mount_program(struct mount_options *options, unsigned long *program)
> >> *program = tmp;
> >> return 1;
> >> }
> >> + break;
> >> case PO_BAD_VALUE:
> >> nfs_error(_("%s: invalid value for 'mountprog=' option"),
> >> progname);
> >> @@ -1509,6 +1512,7 @@ nfs_mount_version(struct mount_options *options, unsigned long *version)
> >> *version = tmp;
> >> return 1;
> >> }
> >> + break;
> >> case PO_BAD_VALUE:
> >> nfs_error(_("%s: invalid value for 'mountvers=' option"),
> >> progname);
> >> @@ -1575,6 +1579,7 @@ nfs_mount_port(struct mount_options *options, unsigned long *port)
> >> *port = tmp;
> >> return 1;
> >> }
> >> + break;
> >> case PO_BAD_VALUE:
> >> nfs_error(_("%s: invalid value for 'mountport=' option"),
> >> progname);
> >> --
> >> 2.13.3
> >>
> >> --
> >> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
> >> the body of a message to [email protected]
> >> More majordomo info at http://vger.kernel.org/majordomo-info.html