# \[PATCH\]\[next\] ima: Fix fall-through warning for Clang

- Subsystems: SECURITY SUBSYSTEM, Extended Verification Module (EVM), INTEGRITY MEASUREMENT ARCHITECTURE (IMA), THE REST
- Maintainers: Paul Moore, James Morris, "Serge E. Hallyn", Mimi Zohar, Roberto Sassu, Dmitry Kasatkin, Linus Torvalds
- List: linux-security-module
- 2 messages, 2 authors
- Page: https://ratatoskr.run/linux-security-module/2021/06/1405604/t

## \[PATCH\]\[next\] ima: Fix fall-through warning for Clang

- From: Gustavo A. R. Silva \<gustavoars@kernel.org\>
- Date: 2021-06-07 20:48:20 
- Message: https://ratatoskr.run/linux-security-module/2021/06/1405604.md

```text
In preparation to enable -Wimplicit-fallthrough for Clang, fix a
fall-through warning by explicitly adding a break statement instead
of just 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>
---
JFYI: We had thousands of these sorts of warnings and now we are down
      to just 13 in linux-next(20210607). This is one of those last
      remaining warnings. :)

 security/integrity/ima/ima_template_lib.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/security/integrity/ima/ima_template_lib.c b/security/integrity/ima/ima_template_lib.c
index 518fd50ea48a..8f96247b4a5c 100644
--- a/security/integrity/ima/ima_template_lib.c
+++ b/security/integrity/ima/ima_template_lib.c
@@ -119,6 +119,7 @@ static void ima_show_template_data_ascii(struct seq_file *m,
 		default:
 			break;
 		}
+		break;
 	default:
 		break;
 	}
-- 
2.27.0

```

## Re: \[PATCH\]\[next\] ima: Fix fall-through warning for Clang

- From: Kees Cook \<hidden\>
- Date: 2021-06-08 17:03:40 
- Message: https://ratatoskr.run/linux-security-module/2021/06/1406792.md

```text
On Mon, Jun 07, 2021 at 03:49:34PM -0500, Gustavo A. R. Silva wrote:
> In preparation to enable -Wimplicit-fallthrough for Clang, fix a
> fall-through warning by explicitly adding a break statement instead
> of just 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>
> ---
> JFYI: We had thousands of these sorts of warnings and now we are down
>       to just 13 in linux-next(20210607). This is one of those last
>       remaining warnings. :)

Looks right to me; thanks!

Reviewed-by: Kees Cook <redacted>

> 
>  security/integrity/ima/ima_template_lib.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/security/integrity/ima/ima_template_lib.c b/security/integrity/ima/ima_template_lib.c
> index 518fd50ea48a..8f96247b4a5c 100644
> --- a/security/integrity/ima/ima_template_lib.c
> +++ b/security/integrity/ima/ima_template_lib.c
> @@ -119,6 +119,7 @@ static void ima_show_template_data_ascii(struct seq_file *m,
>  		default:
>  			break;
>  		}
> +		break;
>  	default:
>  		break;
>  	}
> -- 
> 2.27.0
> 

-- 
Kees Cook
```
