Skip to contentSkip to conversation

net: socket: Fix missing break in switch statement

PATCH Applied Gustavo A. R. Silva 3 participants 5 messages Apr 24, 2019 – Apr 26, 2019

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

PATCH 1/1 net: socket: Fix missing break in switch statement

Add missing break statement in order to prevent the code from falling through to cases SIOCGSTAMP_NEW and SIOCGSTAMPNS_NEW.

This bug was found thanks to the ongoing efforts to enable -Wimplicit-fallthrough.

Fixes 0768e17073dc ("net: socket: implement 64-bit timestamps")
---
 net/socket.c | 1 +
 1 file changed, 1 insertion(+)
net/socket.c +1 -0
index 8d9d4fc7d962..a180e1a9ff23 100644
@@ -1173,6 +1173,7 @@ static long sock_ioctl(struct file *file, unsigned cmd, unsigned long arg)
 			err = sock->ops->gettstamp(sock, argp,
 						   cmd == SIOCGSTAMP_OLD,
 						   !IS_ENABLED(CONFIG_64BIT));
+			break;
 		case SIOCGSTAMP_NEW:
 		case SIOCGSTAMPNS_NEW:
 			if (!sock->ops->gettstamp) {
Signature · 1 line
2.21.0
Acked-by on v1 1/1
#1 lore raw
Quoted 9 lines · Gustavo A. R. Silva

Add missing break statement in order to prevent the code from falling through to cases SIOCGSTAMP_NEW and SIOCGSTAMPNS_NEW.

This bug was found thanks to the ongoing efforts to enable -Wimplicit-fallthrough.

Fixes 0768e17073dc ("net: socket: implement 64-bit timestamps")

I had just prepared the same patch after Dan told me about the issue today, but you managed to submit it first.

Thanks for the fix!

Arnd

#2 lore raw

Arnd,

Quoted 6 lines · Arnd Bergmann
Quoted 4 lines · Gustavo A. R. Silva

Add missing break statement in order to prevent the code from falling through to cases SIOCGSTAMP_NEW and SIOCGSTAMPNS_NEW.

Quoted 7 lines
Quoted 5 lines

This bug was found thanks to the ongoing efforts to enable -Wimplicit-fallthrough.

Fixes 0768e17073dc ("net: socket: implement 64-bit timestamps")

Just for clarification: Dan didn't report this to me. I found this bug while working on the last fall-through warnings in net.

Quoted 7 lines

I had just prepared the same patch after Dan told me about the issue today, but you managed to submit it first.

Thanks for the fix!

Glad to help. :)

Thanks
--
Gustavo

maintainer Applied
#3 lore raw
In reply to Gustavo A. R. Silva

From: "Gustavo A. R. Silva" <[email protected]>
Date: Wed, 24 Apr 2019 10:31:24 -0500

Quoted 8 lines

Add missing break statement in order to prevent the code from falling through to cases SIOCGSTAMP_NEW and SIOCGSTAMPNS_NEW.

This bug was found thanks to the ongoing efforts to enable -Wimplicit-fallthrough.

Fixes 0768e17073dc ("net: socket: implement 64-bit timestamps")

Applied.

#4 lore raw
Quoted 6 lines · David Miller

From: "Gustavo A. R. Silva" <[email protected]>
Date: Wed, 24 Apr 2019 10:31:24 -0500

Quoted 3 lines

Add missing break statement in order to prevent the code from falling through to cases SIOCGSTAMP_NEW and SIOCGSTAMPNS_NEW.

Quoted 8 lines
Quoted 5 lines

This bug was found thanks to the ongoing efforts to enable -Wimplicit-fallthrough.

Fixes 0768e17073dc ("net: socket: implement 64-bit timestamps")

Applied.

Great. :)

Thanks, Dave.
--
Gustavo