net: socket: Fix missing break in switch statement
Subsystems (3)
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.
--- net/socket.c | 1 + 1 file changed, 1 insertion(+)
net/socket.c +1 -0
@@ -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
Quoted 9 lines · Gustavo A. R. Silva
Add missing break statement in order to prevent the code from falling through to cases
SIOCGSTAMP_NEWandSIOCGSTAMPNS_NEW.This bug was found thanks to the ongoing efforts to enable -Wimplicit-fallthrough.
Fixes 0768e17073dc ("net: socket: implement 64-bit timestamps")Signed-off-by Gustavo A. R. Silva <[email protected]>
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
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_NEWandSIOCGSTAMPNS_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")Signed-off-by Gustavo A. R. Silva <[email protected]>Reported-by Dan Carpenter <[email protected]>
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
Acked-by Arnd Bergmann <[email protected]>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
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_NEWandSIOCGSTAMPNS_NEW.This bug was found thanks to the ongoing efforts to enable -Wimplicit-fallthrough.
Fixes 0768e17073dc ("net: socket: implement 64-bit timestamps")Signed-off-by Gustavo A. R. Silva <[email protected]>
Applied.
Quoted 6 lines · David Miller
From: "Gustavo A. R. Silva" <[email protected]>
Date: Wed, 24 Apr 2019 10:31:24 -0500Quoted 3 lines
Add missing break statement in order to prevent the code from falling through to cases
SIOCGSTAMP_NEWandSIOCGSTAMPNS_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")Signed-off-by Gustavo A. R. Silva <[email protected]>Applied.
Great. :)
Thanks, Dave.
--
Gustavo