All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] rds: send: mark expected switch fall-through in rds_rm_size
@ 2018-02-19 18:10 Gustavo A. R. Silva
  2018-02-19 20:06 ` Sowmini Varadhan
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Gustavo A. R. Silva @ 2018-02-19 18:10 UTC (permalink / raw)
  To: Santosh Shilimkar, David S. Miller
  Cc: netdev, linux-rdma, rds-devel, linux-kernel, 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 <gustavo@embeddedor.com>
---
 net/rds/send.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/rds/send.c b/net/rds/send.c
index 028ab59..79d158b 100644
--- a/net/rds/send.c
+++ b/net/rds/send.c
@@ -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;
-- 
2.7.4

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

* Re: [PATCH] rds: send: mark expected switch fall-through in rds_rm_size
  2018-02-19 18:10 [PATCH] rds: send: mark expected switch fall-through in rds_rm_size Gustavo A. R. Silva
@ 2018-02-19 20:06 ` Sowmini Varadhan
  2018-02-20 17:54 ` Santosh Shilimkar
  2018-02-21 19:18 ` David Miller
  2 siblings, 0 replies; 9+ messages in thread
From: Sowmini Varadhan @ 2018-02-19 20:06 UTC (permalink / raw)
  To: Gustavo A. R. Silva
  Cc: Santosh Shilimkar, David S. Miller, netdev, linux-rdma,
	rds-devel, linux-kernel, Gustavo A. R. Silva

On (02/19/18 12:10), Gustavo A. R. Silva wrote:
> 
> In preparation to enabling -Wimplicit-fallthrough, mark switch cases
> where we are expecting to fall through.

Acked-by:  Sowmini Varadhan <sowmini.varadhan@oracle.com>

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

* Re: [PATCH] rds: send: mark expected switch fall-through in rds_rm_size
  2018-02-19 18:10 [PATCH] rds: send: mark expected switch fall-through in rds_rm_size Gustavo A. R. Silva
  2018-02-19 20:06 ` Sowmini Varadhan
@ 2018-02-20 17:54 ` Santosh Shilimkar
  2018-02-20 18:01   ` David Miller
  2018-02-20 18:05   ` Gustavo A. R. Silva
  2018-02-21 19:18 ` David Miller
  2 siblings, 2 replies; 9+ messages in thread
From: Santosh Shilimkar @ 2018-02-20 17:54 UTC (permalink / raw)
  To: Gustavo A. R. Silva
  Cc: David S. Miller, netdev, linux-rdma, rds-devel, linux-kernel,
	Gustavo A. R. Silva

Hi,

2/19/2018 10:10 AM, Gustavo A. R. Silva wrote:
> 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 <gustavo@embeddedor.com>
> ---
>   net/rds/send.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/net/rds/send.c b/net/rds/send.c
> index 028ab59..79d158b 100644
> --- a/net/rds/send.c
> +++ b/net/rds/send.c
> @@ -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,
Acked-by: Santosh Shilimkar <santosh.shilimkar@oracle.com>

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

* Re: [PATCH] rds: send: mark expected switch fall-through in rds_rm_size
  2018-02-20 17:54 ` Santosh Shilimkar
@ 2018-02-20 18:01   ` David Miller
  2018-02-20 18:09     ` Gustavo A. R. Silva
  2018-02-20 18:40     ` Santosh Shilimkar
  2018-02-20 18:05   ` Gustavo A. R. Silva
  1 sibling, 2 replies; 9+ messages in thread
From: David Miller @ 2018-02-20 18:01 UTC (permalink / raw)
  To: santosh.shilimkar
  Cc: gustavo, netdev, linux-rdma, rds-devel, linux-kernel, garsilva

From: Santosh Shilimkar <santosh.shilimkar@oracle.com>
Date: Tue, 20 Feb 2018 09:54:09 -0800

> 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.

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

* Re: [PATCH] rds: send: mark expected switch fall-through in rds_rm_size
  2018-02-20 17:54 ` Santosh Shilimkar
  2018-02-20 18:01   ` David Miller
@ 2018-02-20 18:05   ` Gustavo A. R. Silva
  2018-02-20 18:42     ` Santosh Shilimkar
  1 sibling, 1 reply; 9+ messages in thread
From: Gustavo A. R. Silva @ 2018-02-20 18:05 UTC (permalink / raw)
  To: Santosh Shilimkar, Gustavo A. R. Silva
  Cc: David S. Miller, netdev, linux-rdma, rds-devel, linux-kernel

Hi Santosh,

On 02/20/2018 11:54 AM, Santosh Shilimkar wrote:
> Hi,
> 
> 2/19/2018 10:10 AM, Gustavo A. R. Silva wrote:
>> 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 <gustavo@embeddedor.com>
>> ---
>>   net/rds/send.c | 2 ++
>>   1 file changed, 2 insertions(+)
>>
>> diff --git a/net/rds/send.c b/net/rds/send.c
>> index 028ab59..79d158b 100644
>> --- a/net/rds/send.c
>> +++ b/net/rds/send.c
>> @@ -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 ?
> 

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.

> 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.

> For patch itself,
> Acked-by: Santosh Shilimkar <santosh.shilimkar@oracle.com>

--
Gustavo

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

* Re: [PATCH] rds: send: mark expected switch fall-through in rds_rm_size
  2018-02-20 18:01   ` David Miller
@ 2018-02-20 18:09     ` Gustavo A. R. Silva
  2018-02-20 18:40     ` Santosh Shilimkar
  1 sibling, 0 replies; 9+ messages in thread
From: Gustavo A. R. Silva @ 2018-02-20 18:09 UTC (permalink / raw)
  To: David Miller, santosh.shilimkar
  Cc: gustavo, netdev, linux-rdma, rds-devel, linux-kernel



On 02/20/2018 12:01 PM, David Miller wrote:
> From: Santosh Shilimkar <santosh.shilimkar@oracle.com>
> Date: Tue, 20 Feb 2018 09:54:09 -0800
> 
>> 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

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

* Re: [PATCH] rds: send: mark expected switch fall-through in rds_rm_size
  2018-02-20 18:01   ` David Miller
  2018-02-20 18:09     ` Gustavo A. R. Silva
@ 2018-02-20 18:40     ` Santosh Shilimkar
  1 sibling, 0 replies; 9+ messages in thread
From: Santosh Shilimkar @ 2018-02-20 18:40 UTC (permalink / raw)
  To: David Miller
  Cc: gustavo, netdev, linux-rdma, rds-devel, linux-kernel, garsilva

On 2/20/2018 10:01 AM, David Miller wrote:
> From: Santosh Shilimkar <santosh.shilimkar@oracle.com>
> Date: Tue, 20 Feb 2018 09:54:09 -0800
> 
>> 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 !!

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

* Re: [PATCH] rds: send: mark expected switch fall-through in rds_rm_size
  2018-02-20 18:05   ` Gustavo A. R. Silva
@ 2018-02-20 18:42     ` Santosh Shilimkar
  0 siblings, 0 replies; 9+ messages in thread
From: Santosh Shilimkar @ 2018-02-20 18:42 UTC (permalink / raw)
  To: Gustavo A. R. Silva, Gustavo A. R. Silva
  Cc: David S. Miller, netdev, linux-rdma, rds-devel, linux-kernel

On 2/20/2018 10:05 AM, Gustavo A. R. Silva wrote:
> Hi Santosh,
> 
> On 02/20/2018 11:54 AM, Santosh Shilimkar wrote:
>> Hi,
>>
>> 2/19/2018 10:10 AM, Gustavo A. R. Silva wrote:
>>> 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 <gustavo@embeddedor.com>
>>> ---
>>>   net/rds/send.c | 2 ++
>>>   1 file changed, 2 insertions(+)
>>>
>>> diff --git a/net/rds/send.c b/net/rds/send.c
>>> index 028ab59..79d158b 100644
>>> --- a/net/rds/send.c
>>> +++ b/net/rds/send.c
>>> @@ -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 ?
>>
> 
> 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.

>> 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 !!

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

* Re: [PATCH] rds: send: mark expected switch fall-through in rds_rm_size
  2018-02-19 18:10 [PATCH] rds: send: mark expected switch fall-through in rds_rm_size Gustavo A. R. Silva
  2018-02-19 20:06 ` Sowmini Varadhan
  2018-02-20 17:54 ` Santosh Shilimkar
@ 2018-02-21 19:18 ` David Miller
  2 siblings, 0 replies; 9+ messages in thread
From: David Miller @ 2018-02-21 19:18 UTC (permalink / raw)
  To: gustavo
  Cc: santosh.shilimkar, netdev, linux-rdma, rds-devel, linux-kernel, garsilva

From: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
Date: Mon, 19 Feb 2018 12:10:20 -0600

> 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 <gustavo@embeddedor.com>

Applied.

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

end of thread, other threads:[~2018-02-21 19:18 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-19 18:10 [PATCH] rds: send: mark expected switch fall-through in rds_rm_size Gustavo A. R. Silva
2018-02-19 20:06 ` Sowmini Varadhan
2018-02-20 17:54 ` Santosh Shilimkar
2018-02-20 18:01   ` David Miller
2018-02-20 18:09     ` Gustavo A. R. Silva
2018-02-20 18:40     ` Santosh Shilimkar
2018-02-20 18:05   ` Gustavo A. R. Silva
2018-02-20 18:42     ` Santosh Shilimkar
2018-02-21 19:18 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.