Skip to contentSkip to conversation

Smack: Mark expected switch fall-through

PATCH In review Gustavo A. R. Silva 2 participants 2 messages Aug 1, 2018

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

PATCH 1/1 Smack: Mark expected switch fall-through

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

Notice that in this particular case, I replaced "No break" with a proper "Fall through" annotation, which is what GCC is expecting to find.

Warning level 2 was used: -Wimplicit-fallthrough=2

Addresses-Coverity-ID: 115051 ("Missing break in switch")

---
 security/smack/smack_lsm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
security/smack/smack_lsm.c +1 -1
index ad45761..a307b00 100644
@@ -3739,7 +3739,7 @@ static void smack_d_instantiate(struct dentry *opt_dentry, struct inode *inode)
 		 */
 		final = &smack_known_star;
 		/*
-		 * No break.
+		 * Fall through.
 		 *
 		 * If a smack value has been set we want to use it,
 		 * but since tmpfs isn't giving us the opportunity
Signature · 6 lines
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
maintainer
#1 lore raw
Quoted 6 lines · Gustavo A. R. Silva

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

Notice that in this particular case, I replaced "No break" with a proper "Fall through" annotation, which is what GCC is expecting to find.

Holy bikeshedding, Batman! For decades I've seen "no break" as the proper way to warn that the lack of a "break;" is intentional. I suppose that "Fall through" makes just as much sense. Grumble.

Quoted 4 lines

Warning level 2 was used: -Wimplicit-fallthrough=2

Addresses-Coverity-ID: 115051 ("Missing break in switch")

Sure, I'll take this for 4.20 as my 4.19 changes are complete and there doesn't seem to be special urgency.

Quoted 9 lines
---
 security/smack/smack_lsm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
security/smack/smack_lsm.c +0 -0
index ad45761..a307b00 100644

security/smack/smack_lsm.c static void smack_d_instantiate(struct dentry *opt_dentry, struct inode *inode) · line 3745

Quoted 8 lines
security/smack/smack_lsm.c +1 -1
@@ -3739,7 +3739,7 @@ static void smack_d_instantiate(struct dentry *opt_dentry, struct inode *inode)
 		 */
 		final = &smack_known_star;
 		/*
-		 * No break.
+		 * Fall through.
 		 *
 		 * If a smack value has been set we want to use it,
 		 * but since tmpfs isn't giving us the opportunity

--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html