rds: send: mark expected switch fall-through in rds_rm_size
Subsystems (3)
PATCH 1/1 rds: send: mark expected switch fall-through in rds_rm_size
In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through.
Addresses-Coverity-ID: 1465362 ("Missing break in switch")
--- net/rds/send.c | 2 ++ 1 file changed, 2 insertions(+)
net/rds/send.c +2 -0
@@ -902,6 +902,8 @@ static int rds_rm_size(struct msghdr *msg, int num_sgs)case RDS_CMSG_ZCOPY_COOKIE : zcopy_cookie = true; +/* fall through */ +case RDS_CMSG_RDMA_DEST :case RDS_CMSG_RDMA_MAP : cmsg_groups |=2 ;
Signature · 1 line
2.7.4
Quoted 3 lines · Gustavo A. R. Silva
In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through.
Hi,
Quoted 15 lines · Gustavo A. R. Silva
In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through.
Addresses-Coverity-ID: 1465362 ("Missing break in switch")
Signed-off-by Gustavo A. R. Silva <[email protected]>--- net/rds/send.c | 2 ++ 1 file changed, 2 insertions(+)net/rds/send.c +0
-0
net/rds/send.c static int rds_rm_size(struct msghdr *msg, int num_sgs) · line 909
Quoted 8 lines
net/rds/send.c +2
-0@@ -902,6 +902,8 @@ static int rds_rm_size(struct msghdr *msg, int num_sgs)case RDS_CMSG_ZCOPY_COOKIE : zcopy_cookie = true; +/* fall through */ +case RDS_CMSG_RDMA_DEST :case RDS_CMSG_RDMA_MAP : cmsg_groups |=2 ;
So coverity greps for commet as "fall through" for -Wimplicit-fallthrough build ?
Adding that comments itself if fine but was curious about it if some one makes a spell error in this comment what happens ;-)
For patch itself,
David Miller
maintainerFrom: Santosh Shilimkar <[email protected]>
Date: Tue, 20 Feb 2018 09:54:09 -0800
Quoted 4 lines
So coverity greps for commet as "fall through" for -Wimplicit-fallthrough build ?
From what I understand, 'gcc' does in the latest versions. Coverity
might as well, I don't know.
Quoted 9 lines · David Miller
From: Santosh Shilimkar <[email protected]>
Date: Tue, 20 Feb 2018 09:54:09 -0800Quoted 2 lines
So coverity greps for commet as "fall through" for -Wimplicit-fallthrough build ?
From what I understand, 'gcc' does in the latest versions. Coverity
might as well, I don't know.
Yeah, the one that reports those warnings is GCC.
Coverity only knows about missing break, return and continue.
--
Gustavo
Quoted 9 lines · David Miller
From: Santosh Shilimkar <[email protected]>
Date: Tue, 20 Feb 2018 09:54:09 -0800Quoted 2 lines
So coverity greps for commet as "fall through" for -Wimplicit-fallthrough build ?
From what I understand, 'gcc' does in the latest versions. Coverity
might as well, I don't know.
Good to know about 'gcc' adding such option. Thanks !!
Hi Santosh,
Quoted 12 lines · Santosh Shilimkar
Hi,
Quoted 9 lines · Gustavo A. R. Silva
In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through.
Addresses-Coverity-ID: 1465362 ("Missing break in switch")
Signed-off-by Gustavo A. R. Silva <[email protected]>---
net/rds/send.c| 2 ++1 file changed, 2 insertions(+)
Quoted 17 lines
Quoted 6 lines
net/rds/send.c +0
-0@@ -902,6 +902,8 @@ static int rds_rm_size(struct msghdr *msg, int num_sgs)Quoted 8 lines
case
RDS_CMSG_ZCOPY_COOKIE:
zcopy_cookie= true;
+ /* fall through */
+
caseRDS_CMSG_RDMA_DEST:
caseRDS_CMSG_RDMA_MAP:
cmsg_groups|= 2;So coverity greps for commet as "fall through" for -Wimplicit-fallthrough build ?
No. Basically, Coverity only reports cases in which a break, return or continue statement is missing.
Now, if the statements I mention above are missing and if you add the following line to your Makefile:
KBUILD_CFLAGS += $(call cc-option,-Wimplicit-fallthrough)
You will get a warning if a fall-through comment is missing.
Quoted 4 lines
Adding that comments itself if fine but was curious about it if some one makes a spell error in this comment what happens ;-)
In this case, Coverity would still report the same "Missing break in switch" error, but you'll get a GCC warning.
Quoted 2 lines
For patch itself,
--
Gustavo
Quoted 33 lines · Gustavo A. R. Silva
Hi Santosh,
Quoted 12 lines · Santosh Shilimkar
Hi,
Quoted 9 lines · Gustavo A. R. Silva
In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through.
Addresses-Coverity-ID: 1465362 ("Missing break in switch")
Signed-off-by Gustavo A. R. Silva <[email protected]>---
net/rds/send.c| 2 ++1 file changed, 2 insertions(+)Quoted 17 lines
Quoted 6 lines
net/rds/send.c +0
-0@@ -902,6 +902,8 @@ static int rds_rm_size(struct msghdr *msg, int num_sgs)Quoted 8 lines
case
RDS_CMSG_ZCOPY_COOKIE:
zcopy_cookie= true;
+ /* fall through */
+
caseRDS_CMSG_RDMA_DEST:
caseRDS_CMSG_RDMA_MAP:
cmsg_groups|= 2;So coverity greps for commet as "fall through" for -Wimplicit-fallthrough build ?
Quoted 8 lines
No. Basically, Coverity only reports cases in which a break, return or continue statement is missing.
Now, if the statements I mention above are missing and if you add the following line to your
Makefile:KBUILD_CFLAGS += $(call cc-option,-Wimplicit-fallthrough)
You will get a warning if a fall-through comment is missing.
That make sense.
Quoted 7 lines
Quoted 4 lines
Adding that comments itself if fine but was curious about it if some one makes a spell error in this comment what happens ;-)
In this case, Coverity would still report the same "Missing break in switch" error, but you'll get a GCC warning.
Got it. Thanks !!
From: "Gustavo A. R. Silva" <[email protected]>
Date: Mon, 19 Feb 2018 12:10:20 -0600
Quoted 5 lines
In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through.
Addresses-Coverity-ID: 1465362 ("Missing break in switch")
Signed-off-by Gustavo A. R. Silva <[email protected]>
Applied.