public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Smack: Mark expected switch fall-through
@ 2018-08-01 22:38 Gustavo A. R. Silva
  2018-08-01 22:55 ` Casey Schaufler
  0 siblings, 1 reply; 2+ messages in thread
From: Gustavo A. R. Silva @ 2018-08-01 22:38 UTC (permalink / raw)
  To: Casey Schaufler, James Morris, Serge E. Hallyn
  Cc: linux-security-module, linux-kernel, 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.

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

Addresses-Coverity-ID: 115051 ("Missing break in switch")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
---
 security/smack/smack_lsm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c
index ad45761..a307b00 100644
--- a/security/smack/smack_lsm.c
+++ b/security/smack/smack_lsm.c
@@ -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
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Smack: Mark expected switch fall-through
  2018-08-01 22:38 [PATCH] Smack: Mark expected switch fall-through Gustavo A. R. Silva
@ 2018-08-01 22:55 ` Casey Schaufler
  0 siblings, 0 replies; 2+ messages in thread
From: Casey Schaufler @ 2018-08-01 22:55 UTC (permalink / raw)
  To: Gustavo A. R. Silva, James Morris, Serge E. Hallyn
  Cc: linux-security-module, linux-kernel, Casey Schaufler

On 8/1/2018 3:38 PM, Gustavo A. R. Silva wrote:
> 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.

> Warning level 2 was used: -Wimplicit-fallthrough=2
>
> Addresses-Coverity-ID: 115051 ("Missing break in switch")
> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>

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

> ---
>  security/smack/smack_lsm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c
> index ad45761..a307b00 100644
> --- a/security/smack/smack_lsm.c
> +++ b/security/smack/smack_lsm.c
> @@ -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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-08-01 22:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-08-01 22:38 [PATCH] Smack: Mark expected switch fall-through Gustavo A. R. Silva
2018-08-01 22:55 ` Casey Schaufler

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox