Skip to contentSkip to conversation

skbuff: Mark expected switch fall-throughs

PATCH Superseded Gustavo A. R. Silva 2 participants 4 messages Oct 13, 2018 – Oct 17, 2018 Networking

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 skbuff: Mark expected switch fall-throughs

In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through.

---
 include/linux/skbuff.h | 6 ++++++
 1 file changed, 6 insertions(+)
include/linux/skbuff.h +6 -0
index 119d092..92ec346 100644
@@ -3505,13 +3505,19 @@ static inline bool __skb_metadata_differs(const struct sk_buff *skb_a,
 #define __it(x, op) (x -= sizeof(u##op))
 #define __it_diff(a, b, op) (*(u##op *)__it(a, op)) ^ (*(u##op *)__it(b, op))
 	case 32: diffs |= __it_diff(a, b, 64);
+		/* fall through */
 	case 24: diffs |= __it_diff(a, b, 64);
+		/* fall through */
 	case 16: diffs |= __it_diff(a, b, 64);
+		/* fall through */
 	case  8: diffs |= __it_diff(a, b, 64);
 		break;
 	case 28: diffs |= __it_diff(a, b, 64);
+		/* fall through */
 	case 20: diffs |= __it_diff(a, b, 64);
+		/* fall through */
 	case 12: diffs |= __it_diff(a, b, 64);
+		/* fall through */
 	case  4: diffs |= __it_diff(a, b, 32);
 		break;
 	}
Signature · 1 line
2.7.4
Acked-by on v1 1/1
#1 lore raw
Quoted 4 lines · Gustavo A. R. Silva

In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through.

-Kees

Quoted 31 lines
---
 include/linux/skbuff.h | 6 ++++++
 1 file changed, 6 insertions(+)
include/linux/skbuff.h +6 -1
index 119d092..92ec346 100644
@@ -3505,13 +3505,19 @@ static inline bool __skb_metadata_differs(const struct sk_buff *skb_a,
 #define __it(x, op) (x -= sizeof(u##op))
 #define __it_diff(a, b, op) (*(u##op *)__it(a, op)) ^ (*(u##op *)__it(b, op))
        case 32: diffs |= __it_diff(a, b, 64);
+               /* fall through */
        case 24: diffs |= __it_diff(a, b, 64);
+               /* fall through */
        case 16: diffs |= __it_diff(a, b, 64);
+               /* fall through */
        case  8: diffs |= __it_diff(a, b, 64);
                break;
        case 28: diffs |= __it_diff(a, b, 64);
+               /* fall through */
        case 20: diffs |= __it_diff(a, b, 64);
+               /* fall through */
        case 12: diffs |= __it_diff(a, b, 64);
+               /* fall through */
        case  4: diffs |= __it_diff(a, b, 32);
                break;
        }
--

2.7.4

Signature · 2 lines
Kees Cook
Pixel Security
#2 lore raw
Quoted 8 lines · Kees Cook
Quoted 4 lines · Gustavo A. R. Silva

In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through.

Actually, since this is skbuff, can you resend this to netdev instead? Andrew took the other two, but this one seems like it should go via David Miller.

Thanks!

-Kees

Quoted 40 lines

-Kees

Quoted 29 lines
---
 include/linux/skbuff.h | 6 ++++++
 1 file changed, 6 insertions(+)
include/linux/skbuff.h +6 -1
index 119d092..92ec346 100644
@@ -3505,13 +3505,19 @@ static inline bool __skb_metadata_differs(const struct sk_buff *skb_a,
 #define __it(x, op) (x -= sizeof(u##op))
 #define __it_diff(a, b, op) (*(u##op *)__it(a, op)) ^ (*(u##op *)__it(b, op))
        case 32: diffs |= __it_diff(a, b, 64);
+               /* fall through */
        case 24: diffs |= __it_diff(a, b, 64);
+               /* fall through */
        case 16: diffs |= __it_diff(a, b, 64);
+               /* fall through */
        case  8: diffs |= __it_diff(a, b, 64);
                break;
        case 28: diffs |= __it_diff(a, b, 64);
+               /* fall through */
        case 20: diffs |= __it_diff(a, b, 64);
+               /* fall through */
        case 12: diffs |= __it_diff(a, b, 64);
+               /* fall through */
        case  4: diffs |= __it_diff(a, b, 32);
                break;
        }
--
Quoted 2 lines

2.7.4

--
Kees Cook
Pixel Security

Signature · 2 lines
Kees Cook
Pixel Security
#3 lore raw
Quoted 5 lines · Kees Cook

Actually, since this is skbuff, can you resend this to netdev instead? Andrew took the other two, but this one seems like it should go via David Miller.

Sure thing. Will do.

Thanks
--
Gustavo