diff mbox series

[052/141] security: keys: Fix fall-through warnings for Clang

Message ID 412e11590b667712c03c1e4d4c7573fda3a4b1cb.1605896059.git.gustavoars@kernel.org (mailing list archive)
State New, archived
Headers show
Series Fix fall-through warnings for Clang | expand

Commit Message

Gustavo A. R. Silva Nov. 20, 2020, 6:32 p.m. UTC
In preparation to enable -Wimplicit-fallthrough for Clang, fix a warning
by explicitly adding a break statement instead of letting the code fall
through to the next case.

Link: https://github.com/KSPP/linux/issues/115
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
---
 security/keys/process_keys.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Jarkko Sakkinen Nov. 23, 2020, 10:54 p.m. UTC | #1
On Fri, Nov 20, 2020 at 12:32:20PM -0600, Gustavo A. R. Silva wrote:
> In preparation to enable -Wimplicit-fallthrough for Clang, fix a warning
> by explicitly adding a break statement instead of letting the code fall
> through to the next case.
> 
> Link: https://github.com/KSPP/linux/issues/115
> Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
> ---
>  security/keys/process_keys.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/security/keys/process_keys.c b/security/keys/process_keys.c
> index 1fe8b934f656..e3d79a7b6db6 100644
> --- a/security/keys/process_keys.c
> +++ b/security/keys/process_keys.c
> @@ -783,6 +783,7 @@ key_ref_t lookup_user_key(key_serial_t id, unsigned long lflags,
>  				if (need_perm != KEY_AUTHTOKEN_OVERRIDE &&
>  				    need_perm != KEY_DEFER_PERM_CHECK)
>  					goto invalid_key;
> +				break;
>  			case 0:
>  				break;
>  			}
> -- 
> 2.27.0
> 
> 


Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>

/Jarkko
Gustavo A. R. Silva Nov. 24, 2020, 2:30 p.m. UTC | #2
On Tue, Nov 24, 2020 at 12:54:02AM +0200, Jarkko Sakkinen wrote:
> On Fri, Nov 20, 2020 at 12:32:20PM -0600, Gustavo A. R. Silva wrote:
> > In preparation to enable -Wimplicit-fallthrough for Clang, fix a warning
> > by explicitly adding a break statement instead of letting the code fall
> > through to the next case.
> > 
> > Link: https://github.com/KSPP/linux/issues/115
> > Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
> > ---
> >  security/keys/process_keys.c | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/security/keys/process_keys.c b/security/keys/process_keys.c
> > index 1fe8b934f656..e3d79a7b6db6 100644
> > --- a/security/keys/process_keys.c
> > +++ b/security/keys/process_keys.c
> > @@ -783,6 +783,7 @@ key_ref_t lookup_user_key(key_serial_t id, unsigned long lflags,
> >  				if (need_perm != KEY_AUTHTOKEN_OVERRIDE &&
> >  				    need_perm != KEY_DEFER_PERM_CHECK)
> >  					goto invalid_key;
> > +				break;
> >  			case 0:
> >  				break;
> >  			}
> > -- 
> > 2.27.0
> > 
> > 
> 
> 
> Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>

Thank you, Jarkko.
--
Gustavo
diff mbox series

Patch

diff --git a/security/keys/process_keys.c b/security/keys/process_keys.c
index 1fe8b934f656..e3d79a7b6db6 100644
--- a/security/keys/process_keys.c
+++ b/security/keys/process_keys.c
@@ -783,6 +783,7 @@  key_ref_t lookup_user_key(key_serial_t id, unsigned long lflags,
 				if (need_perm != KEY_AUTHTOKEN_OVERRIDE &&
 				    need_perm != KEY_DEFER_PERM_CHECK)
 					goto invalid_key;
+				break;
 			case 0:
 				break;
 			}