Skip to contentSkip to conversation

: break missing at end of switch statement

PATCH In review Gerrit Renker 4 participants 8 messages Oct 1, 2007

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 : break missing at end of switch statement

[TCP]: break missing at end of switch statement

---

net/ipv4/tcp_input.c +1 -0
@@ -3129,6 +3129,7 @@ static void tcp_reset(struct sock *sk)
 			return;
 		default:
 			sk->sk_err = ECONNRESET;
+			break;
 	}
 
 	if (!sock_flag(sk, SOCK_DEAD))
#1 lore raw

net/ipv4/tcp_input.c static void tcp_reset(struct sock *sk) · line 3133

Quoted 12 lines · Gerrit Renker

[TCP]: break missing at end of switch statement

---

net/ipv4/tcp_input.c +1 -0
@@ -3129,6 +3129,7 @@ static void tcp_reset(struct sock *sk)
 			return;
 		default:
 			sk->sk_err = ECONNRESET;
+			break;
 	}

Huh? Why on the Earth would that be a problem?

#2 lore raw

Quoting Al Viro:

|  On Mon, Oct 01, 2007 at 01:32:43PM +0100, Gerrit Renker wrote:
|  > [TCP]: break missing at end of switch statement
|  > 
|  > Signed-off-by: Gerrit Renker <[email protected]>
|  > ---
|  > --- a/net/ipv4/tcp_input.c
|  > +++ b/net/ipv4/tcp_input.c
|  > @@ -3129,6 +3129,7 @@ static void tcp_reset(struct sock *sk)
|  >  			return;
|  >  		default:
|  >  			sk->sk_err = ECONNRESET;
|  > +			break;
|  >  	}
|  
|  Huh?  Why on the Earth would that be a problem?
|  
|  

Sorry what is your question?

#3 lore raw
Quoted 18 lines · Gerrit Renker

Quoting Al Viro:

|  On Mon, Oct 01, 2007 at 01:32:43PM +0100, Gerrit Renker wrote:
|  > [TCP]: break missing at end of switch statement
|  > 
|  > Signed-off-by: Gerrit Renker <[email protected]>
|  > ---
|  > --- a/net/ipv4/tcp_input.c
|  > +++ b/net/ipv4/tcp_input.c
|  > @@ -3129,6 +3129,7 @@ static void tcp_reset(struct sock *sk)
|  >  			return;
|  >  		default:
|  >  			sk->sk_err = ECONNRESET;
|  > +			break;
|  >  	}
|  
|  Huh?  Why on the Earth would that be a problem?
|  
|  
Quoted 1 line

Sorry what is your question?

Why the hell is $Subject a problem that warrants any patches whatsoever?

#4 lore raw
In reply to Gerrit Renker

In article <200710011332.43657@strip-the-willow> (at Mon, 1 Oct 2007 13:32:43 +0100), Gerrit Renker <[email protected]> says:

Quoted 7 lines

[TCP]: break missing at end of switch statement

---

net/ipv4/tcp_input.c static void tcp_reset(struct sock *sk) · line 3135

Quoted 7 lines
net/ipv4/tcp_input.c +1 -0
@@ -3129,6 +3129,7 @@ static void tcp_reset(struct sock *sk)
 			return;
 		default:
 			sk->sk_err = ECONNRESET;
+			break;
 	}
 
 	if (!sock_flag(sk, SOCK_DEAD))

NAK; it is not required at all.

--yoshfuji

#5 lore raw

Quoting YOSHIFUJI Hideaki:

| 
|  > [TCP]: break missing at end of switch statement
|  > 
|  > Signed-off-by: Gerrit Renker <[email protected]>
|  > ---
|  > --- a/net/ipv4/tcp_input.c
|  > +++ b/net/ipv4/tcp_input.c
|  > @@ -3129,6 +3129,7 @@ static void tcp_reset(struct sock *sk)
|  >  			return;
|  >  		default:
|  >  			sk->sk_err = ECONNRESET;
|  > +			break;
|  >  	}
|  >  
|  >  	if (!sock_flag(sk, SOCK_DEAD))
|  
|  NAK; it is not required at all.
|  
|  --yoshfuji
|  

If it were true what you are saying then the statement

       `sk->sk_err = ECONNRESET;' 

can go as well since it will always be overridden.

#6 lore raw

Em Mon, Oct 01, 2007 at 02:39:28PM +0100, Gerrit Renker escreveu:

Quoted 21 lines

Quoting YOSHIFUJI Hideaki:

| 
|  > [TCP]: break missing at end of switch statement
|  > 
|  > Signed-off-by: Gerrit Renker <[email protected]>
|  > ---
|  > --- a/net/ipv4/tcp_input.c
|  > +++ b/net/ipv4/tcp_input.c
|  > @@ -3129,6 +3129,7 @@ static void tcp_reset(struct sock *sk)
|  >  			return;
|  >  		default:
|  >  			sk->sk_err = ECONNRESET;
|  > +			break;
|  >  	}
|  >  
|  >  	if (!sock_flag(sk, SOCK_DEAD))
|  
|  NAK; it is not required at all.
|  
|  --yoshfuji
|  
Quoted 5 lines

If it were true what you are saying then the statement

       `sk->sk_err = ECONNRESET;' 

can go as well since it will always be overridden.

Gerrit,

It is not required. The statement you mention will be executed
when the sk_state is not one of TCP_SYN_SENT, TCP_CLOSE_WAIT or TCP_CLOSE.

A 'break' is only needed in a label block if it is not the last
one.

- Arnaldo

#7 lore raw

Arnaldo, Al Viro, and Yoshifuji -

sorry for having wasted your time with this one. You are right, that was complete nonsense. I don't know where my mind was - even my test program used to `prove' this was screwed up.

So nothing wrong here and thank you very much for your clarifying comments.

|  > |  > --- a/net/ipv4/tcp_input.c
|  > |  > +++ b/net/ipv4/tcp_input.c
|  > |  > @@ -3129,6 +3129,7 @@ static void tcp_reset(struct sock *sk)
|  > |  >  			return;
|  > |  >  		default:
|  > |  >  			sk->sk_err = ECONNRESET;
|  > |  > +			break;
|  > |  >  	}
|  > |  >  
|  > |  >  	if (!sock_flag(sk, SOCK_DEAD))
|  > |  
|  > |  NAK; it is not required at all.
|  > |  
|  > |  --yoshfuji
|  > |  
|  > If it were true what you are saying then the statement 
|  > 
|  >        `sk->sk_err = ECONNRESET;' 
|  > 
|  > can go as well since it will always be overridden.
|  
|  Gerrit,
|  
|          It is not required. The statement you mention will be executed
|  when the sk_state is not one of TCP_SYN_SENT, TCP_CLOSE_WAIT or
|  TCP_CLOSE.
|  
|  	A 'break' is only needed in a label block if it is not the last
|  one.
|  
|  - Arnaldo
|  
|