linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] s390/net: Mark expected switch fall-throughs
@ 2019-07-30  0:17 Gustavo A. R. Silva
  2019-07-30 16:59 ` Kees Cook
  2019-08-05  7:25 ` Julian Wiedmann
  0 siblings, 2 replies; 3+ messages in thread
From: Gustavo A. R. Silva @ 2019-07-30  0:17 UTC (permalink / raw)
  To: Julian Wiedmann, Ursula Braun, Heiko Carstens, Vasily Gorbik,
	Christian Borntraeger
  Cc: linux-s390, linux-kernel, Gustavo A. R. Silva, Kees Cook

Mark switch cases where we are expecting to fall through.

This patch fixes the following warnings (Building: s390):

drivers/s390/net/ctcm_fsms.c: In function ‘ctcmpc_chx_attnbusy’:
drivers/s390/net/ctcm_fsms.c:1703:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
   if (grp->changed_side == 1) {
      ^
drivers/s390/net/ctcm_fsms.c:1707:2: note: here
  case MPCG_STATE_XID0IOWAIX:
  ^~~~

drivers/s390/net/ctcm_mpc.c: In function ‘ctc_mpc_alloc_channel’:
drivers/s390/net/ctcm_mpc.c:358:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
   if (callback)
      ^
drivers/s390/net/ctcm_mpc.c:360:2: note: here
  case MPCG_STATE_XID0IOWAIT:
  ^~~~

drivers/s390/net/ctcm_mpc.c: In function ‘mpc_action_timeout’:
drivers/s390/net/ctcm_mpc.c:1469:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
   if ((fsm_getstate(rch->fsm) == CH_XID0_PENDING) &&
      ^
drivers/s390/net/ctcm_mpc.c:1472:2: note: here
  default:
  ^~~~~~~
drivers/s390/net/ctcm_mpc.c: In function ‘mpc_send_qllc_discontact’:
drivers/s390/net/ctcm_mpc.c:2087:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
   if (grp->estconnfunc) {
      ^
drivers/s390/net/ctcm_mpc.c:2092:2: note: here
  case MPCG_STATE_FLOWC:
  ^~~~

drivers/s390/net/qeth_l2_main.c: In function ‘qeth_l2_process_inbound_buffer’:
drivers/s390/net/qeth_l2_main.c:328:7: warning: this statement may fall through [-Wimplicit-fallthrough=]
    if (IS_OSN(card)) {
       ^
drivers/s390/net/qeth_l2_main.c:337:3: note: here
   default:
   ^~~~~~~

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
---
 drivers/s390/net/ctcm_fsms.c    | 1 +
 drivers/s390/net/ctcm_mpc.c     | 3 +++
 drivers/s390/net/qeth_l2_main.c | 2 +-
 3 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/s390/net/ctcm_fsms.c b/drivers/s390/net/ctcm_fsms.c
index 1b4ee570b712..4a8a5373cb35 100644
--- a/drivers/s390/net/ctcm_fsms.c
+++ b/drivers/s390/net/ctcm_fsms.c
@@ -1704,6 +1704,7 @@ static void ctcmpc_chx_attnbusy(fsm_instance *fsm, int event, void *arg)
 			grp->changed_side = 2;
 			break;
 		}
+		/* Else, fall through */
 	case MPCG_STATE_XID0IOWAIX:
 	case MPCG_STATE_XID7INITW:
 	case MPCG_STATE_XID7INITX:
diff --git a/drivers/s390/net/ctcm_mpc.c b/drivers/s390/net/ctcm_mpc.c
index e02f295d38a9..1534420a0243 100644
--- a/drivers/s390/net/ctcm_mpc.c
+++ b/drivers/s390/net/ctcm_mpc.c
@@ -357,6 +357,7 @@ int ctc_mpc_alloc_channel(int port_num, void (*callback)(int, int))
 		/*fsm_newstate(grp->fsm, MPCG_STATE_XID2INITW);*/
 		if (callback)
 			grp->send_qllc_disc = 1;
+		/* Else, fall through */
 	case MPCG_STATE_XID0IOWAIT:
 		fsm_deltimer(&grp->timer);
 		grp->outstanding_xid2 = 0;
@@ -1469,6 +1470,7 @@ static void mpc_action_timeout(fsm_instance *fi, int event, void *arg)
 		if ((fsm_getstate(rch->fsm) == CH_XID0_PENDING) &&
 		   (fsm_getstate(wch->fsm) == CH_XID0_PENDING))
 			break;
+		/* Else, fall through */
 	default:
 		fsm_event(grp->fsm, MPCG_EVENT_INOP, dev);
 	}
@@ -2089,6 +2091,7 @@ static int mpc_send_qllc_discontact(struct net_device *dev)
 			grp->estconnfunc = NULL;
 			break;
 		}
+		/* Else, fall through */
 	case MPCG_STATE_FLOWC:
 	case MPCG_STATE_READY:
 		grp->send_qllc_disc = 2;
diff --git a/drivers/s390/net/qeth_l2_main.c b/drivers/s390/net/qeth_l2_main.c
index fd64bc3f4062..cbead3d1b2fd 100644
--- a/drivers/s390/net/qeth_l2_main.c
+++ b/drivers/s390/net/qeth_l2_main.c
@@ -333,7 +333,7 @@ static int qeth_l2_process_inbound_buffer(struct qeth_card *card,
 				card->osn_info.data_cb(skb);
 				break;
 			}
-			/* else unknown */
+			/* Else, fall through */
 		default:
 			dev_kfree_skb_any(skb);
 			QETH_CARD_TEXT(card, 3, "inbunkno");
-- 
2.22.0


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

* Re: [PATCH] s390/net: Mark expected switch fall-throughs
  2019-07-30  0:17 [PATCH] s390/net: Mark expected switch fall-throughs Gustavo A. R. Silva
@ 2019-07-30 16:59 ` Kees Cook
  2019-08-05  7:25 ` Julian Wiedmann
  1 sibling, 0 replies; 3+ messages in thread
From: Kees Cook @ 2019-07-30 16:59 UTC (permalink / raw)
  To: Gustavo A. R. Silva
  Cc: Julian Wiedmann, Ursula Braun, Heiko Carstens, Vasily Gorbik,
	Christian Borntraeger, linux-s390, linux-kernel

On Mon, Jul 29, 2019 at 07:17:15PM -0500, Gustavo A. R. Silva wrote:
> Mark switch cases where we are expecting to fall through.
> 
> This patch fixes the following warnings (Building: s390):
> 
> drivers/s390/net/ctcm_fsms.c: In function ‘ctcmpc_chx_attnbusy’:
> drivers/s390/net/ctcm_fsms.c:1703:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
>    if (grp->changed_side == 1) {
>       ^
> drivers/s390/net/ctcm_fsms.c:1707:2: note: here
>   case MPCG_STATE_XID0IOWAIX:
>   ^~~~
> 
> drivers/s390/net/ctcm_mpc.c: In function ‘ctc_mpc_alloc_channel’:
> drivers/s390/net/ctcm_mpc.c:358:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
>    if (callback)
>       ^
> drivers/s390/net/ctcm_mpc.c:360:2: note: here
>   case MPCG_STATE_XID0IOWAIT:
>   ^~~~
> 
> drivers/s390/net/ctcm_mpc.c: In function ‘mpc_action_timeout’:
> drivers/s390/net/ctcm_mpc.c:1469:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
>    if ((fsm_getstate(rch->fsm) == CH_XID0_PENDING) &&
>       ^
> drivers/s390/net/ctcm_mpc.c:1472:2: note: here
>   default:
>   ^~~~~~~
> drivers/s390/net/ctcm_mpc.c: In function ‘mpc_send_qllc_discontact’:
> drivers/s390/net/ctcm_mpc.c:2087:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
>    if (grp->estconnfunc) {
>       ^
> drivers/s390/net/ctcm_mpc.c:2092:2: note: here
>   case MPCG_STATE_FLOWC:
>   ^~~~
> 
> drivers/s390/net/qeth_l2_main.c: In function ‘qeth_l2_process_inbound_buffer’:
> drivers/s390/net/qeth_l2_main.c:328:7: warning: this statement may fall through [-Wimplicit-fallthrough=]
>     if (IS_OSN(card)) {
>        ^
> drivers/s390/net/qeth_l2_main.c:337:3: note: here
>    default:
>    ^~~~~~~
> 
> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>

Reviewed-by: Kees Cook <keescook@chromium.org>

-Kees

> ---
>  drivers/s390/net/ctcm_fsms.c    | 1 +
>  drivers/s390/net/ctcm_mpc.c     | 3 +++
>  drivers/s390/net/qeth_l2_main.c | 2 +-
>  3 files changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/s390/net/ctcm_fsms.c b/drivers/s390/net/ctcm_fsms.c
> index 1b4ee570b712..4a8a5373cb35 100644
> --- a/drivers/s390/net/ctcm_fsms.c
> +++ b/drivers/s390/net/ctcm_fsms.c
> @@ -1704,6 +1704,7 @@ static void ctcmpc_chx_attnbusy(fsm_instance *fsm, int event, void *arg)
>  			grp->changed_side = 2;
>  			break;
>  		}
> +		/* Else, fall through */
>  	case MPCG_STATE_XID0IOWAIX:
>  	case MPCG_STATE_XID7INITW:
>  	case MPCG_STATE_XID7INITX:
> diff --git a/drivers/s390/net/ctcm_mpc.c b/drivers/s390/net/ctcm_mpc.c
> index e02f295d38a9..1534420a0243 100644
> --- a/drivers/s390/net/ctcm_mpc.c
> +++ b/drivers/s390/net/ctcm_mpc.c
> @@ -357,6 +357,7 @@ int ctc_mpc_alloc_channel(int port_num, void (*callback)(int, int))
>  		/*fsm_newstate(grp->fsm, MPCG_STATE_XID2INITW);*/
>  		if (callback)
>  			grp->send_qllc_disc = 1;
> +		/* Else, fall through */
>  	case MPCG_STATE_XID0IOWAIT:
>  		fsm_deltimer(&grp->timer);
>  		grp->outstanding_xid2 = 0;
> @@ -1469,6 +1470,7 @@ static void mpc_action_timeout(fsm_instance *fi, int event, void *arg)
>  		if ((fsm_getstate(rch->fsm) == CH_XID0_PENDING) &&
>  		   (fsm_getstate(wch->fsm) == CH_XID0_PENDING))
>  			break;
> +		/* Else, fall through */
>  	default:
>  		fsm_event(grp->fsm, MPCG_EVENT_INOP, dev);
>  	}
> @@ -2089,6 +2091,7 @@ static int mpc_send_qllc_discontact(struct net_device *dev)
>  			grp->estconnfunc = NULL;
>  			break;
>  		}
> +		/* Else, fall through */
>  	case MPCG_STATE_FLOWC:
>  	case MPCG_STATE_READY:
>  		grp->send_qllc_disc = 2;
> diff --git a/drivers/s390/net/qeth_l2_main.c b/drivers/s390/net/qeth_l2_main.c
> index fd64bc3f4062..cbead3d1b2fd 100644
> --- a/drivers/s390/net/qeth_l2_main.c
> +++ b/drivers/s390/net/qeth_l2_main.c
> @@ -333,7 +333,7 @@ static int qeth_l2_process_inbound_buffer(struct qeth_card *card,
>  				card->osn_info.data_cb(skb);
>  				break;
>  			}
> -			/* else unknown */
> +			/* Else, fall through */
>  		default:
>  			dev_kfree_skb_any(skb);
>  			QETH_CARD_TEXT(card, 3, "inbunkno");
> -- 
> 2.22.0
> 

-- 
Kees Cook

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

* Re: [PATCH] s390/net: Mark expected switch fall-throughs
  2019-07-30  0:17 [PATCH] s390/net: Mark expected switch fall-throughs Gustavo A. R. Silva
  2019-07-30 16:59 ` Kees Cook
@ 2019-08-05  7:25 ` Julian Wiedmann
  1 sibling, 0 replies; 3+ messages in thread
From: Julian Wiedmann @ 2019-08-05  7:25 UTC (permalink / raw)
  To: Gustavo A. R. Silva, Ursula Braun, Heiko Carstens, Vasily Gorbik,
	Christian Borntraeger
  Cc: linux-s390, linux-kernel, Kees Cook

On 30.07.19 02:17, Gustavo A. R. Silva wrote:
> Mark switch cases where we are expecting to fall through.
> 
> This patch fixes the following warnings (Building: s390):
> 
> drivers/s390/net/ctcm_fsms.c: In function ‘ctcmpc_chx_attnbusy’:
> drivers/s390/net/ctcm_fsms.c:1703:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
>    if (grp->changed_side == 1) {
>       ^
> drivers/s390/net/ctcm_fsms.c:1707:2: note: here
>   case MPCG_STATE_XID0IOWAIX:
>   ^~~~
> 
> drivers/s390/net/ctcm_mpc.c: In function ‘ctc_mpc_alloc_channel’:
> drivers/s390/net/ctcm_mpc.c:358:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
>    if (callback)
>       ^
> drivers/s390/net/ctcm_mpc.c:360:2: note: here
>   case MPCG_STATE_XID0IOWAIT:
>   ^~~~
> 
> drivers/s390/net/ctcm_mpc.c: In function ‘mpc_action_timeout’:
> drivers/s390/net/ctcm_mpc.c:1469:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
>    if ((fsm_getstate(rch->fsm) == CH_XID0_PENDING) &&
>       ^
> drivers/s390/net/ctcm_mpc.c:1472:2: note: here
>   default:
>   ^~~~~~~
> drivers/s390/net/ctcm_mpc.c: In function ‘mpc_send_qllc_discontact’:
> drivers/s390/net/ctcm_mpc.c:2087:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
>    if (grp->estconnfunc) {
>       ^
> drivers/s390/net/ctcm_mpc.c:2092:2: note: here
>   case MPCG_STATE_FLOWC:
>   ^~~~
> 
> drivers/s390/net/qeth_l2_main.c: In function ‘qeth_l2_process_inbound_buffer’:
> drivers/s390/net/qeth_l2_main.c:328:7: warning: this statement may fall through [-Wimplicit-fallthrough=]
>     if (IS_OSN(card)) {
>        ^
> drivers/s390/net/qeth_l2_main.c:337:3: note: here
>    default:
>    ^~~~~~~
> 
> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
> ---
>  drivers/s390/net/ctcm_fsms.c    | 1 +
>  drivers/s390/net/ctcm_mpc.c     | 3 +++
>  drivers/s390/net/qeth_l2_main.c | 2 +-
>  3 files changed, 5 insertions(+), 1 deletion(-)
> 

Applied, thanks.


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

end of thread, other threads:[~2019-08-05  7:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-30  0:17 [PATCH] s390/net: Mark expected switch fall-throughs Gustavo A. R. Silva
2019-07-30 16:59 ` Kees Cook
2019-08-05  7:25 ` Julian Wiedmann

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