2020-11-20 18:28:09

by Gustavo A. R. Silva

[permalink] [raw]
Subject: [PATCH 010/141] ima: Fix fall-through warnings for Clang

In preparation to enable -Wimplicit-fallthrough for Clang, fix multiple
warnings by explicitly adding multiple break statements 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 <[email protected]>
---
security/integrity/ima/ima_main.c | 1 +
security/integrity/ima/ima_policy.c | 2 ++
2 files changed, 3 insertions(+)

diff --git a/security/integrity/ima/ima_main.c b/security/integrity/ima/ima_main.c
index 2d1af8899cab..600b97677085 100644
--- a/security/integrity/ima/ima_main.c
+++ b/security/integrity/ima/ima_main.c
@@ -743,6 +743,7 @@ int ima_load_data(enum kernel_load_data_id id, bool contents)
pr_err("impossible to appraise a module without a file descriptor. sig_enforce kernel parameter might help\n");
return -EACCES; /* INTEGRITY_UNKNOWN */
}
+ break;
default:
break;
}
diff --git a/security/integrity/ima/ima_policy.c b/security/integrity/ima/ima_policy.c
index 9b5adeaa47fc..ea634fc3b82f 100644
--- a/security/integrity/ima/ima_policy.c
+++ b/security/integrity/ima/ima_policy.c
@@ -566,6 +566,7 @@ static bool ima_match_rules(struct ima_rule_entry *rule, struct inode *inode,
rc = ima_filter_rule_match(secid, rule->lsm[i].type,
Audit_equal,
rule->lsm[i].rule);
+ break;
default:
break;
}
@@ -802,6 +803,7 @@ void __init ima_init_policy(void)
add_rules(default_measurement_rules,
ARRAY_SIZE(default_measurement_rules),
IMA_DEFAULT_POLICY);
+ break;
default:
break;
}
--
2.27.0


2021-04-20 20:55:22

by Gustavo A. R. Silva

[permalink] [raw]
Subject: Re: [PATCH 010/141] ima: Fix fall-through warnings for Clang

Hi all,

Friendly ping: who can take this, please?

Thanks
--
Gustavo

On 11/20/20 12:25, Gustavo A. R. Silva wrote:
> In preparation to enable -Wimplicit-fallthrough for Clang, fix multiple
> warnings by explicitly adding multiple break statements 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 <[email protected]>
> ---
> security/integrity/ima/ima_main.c | 1 +
> security/integrity/ima/ima_policy.c | 2 ++
> 2 files changed, 3 insertions(+)
>
> diff --git a/security/integrity/ima/ima_main.c b/security/integrity/ima/ima_main.c
> index 2d1af8899cab..600b97677085 100644
> --- a/security/integrity/ima/ima_main.c
> +++ b/security/integrity/ima/ima_main.c
> @@ -743,6 +743,7 @@ int ima_load_data(enum kernel_load_data_id id, bool contents)
> pr_err("impossible to appraise a module without a file descriptor. sig_enforce kernel parameter might help\n");
> return -EACCES; /* INTEGRITY_UNKNOWN */
> }
> + break;
> default:
> break;
> }
> diff --git a/security/integrity/ima/ima_policy.c b/security/integrity/ima/ima_policy.c
> index 9b5adeaa47fc..ea634fc3b82f 100644
> --- a/security/integrity/ima/ima_policy.c
> +++ b/security/integrity/ima/ima_policy.c
> @@ -566,6 +566,7 @@ static bool ima_match_rules(struct ima_rule_entry *rule, struct inode *inode,
> rc = ima_filter_rule_match(secid, rule->lsm[i].type,
> Audit_equal,
> rule->lsm[i].rule);
> + break;
> default:
> break;
> }
> @@ -802,6 +803,7 @@ void __init ima_init_policy(void)
> add_rules(default_measurement_rules,
> ARRAY_SIZE(default_measurement_rules),
> IMA_DEFAULT_POLICY);
> + break;
> default:
> break;
> }
>

2021-04-20 21:33:55

by Mimi Zohar

[permalink] [raw]
Subject: Re: [PATCH 010/141] ima: Fix fall-through warnings for Clang

Hi Gustavo,

On Tue, 2021-04-20 at 15:28 -0500, Gustavo A. R. Silva wrote:
> Hi all,
>
> Friendly ping: who can take this, please?

Thank you for the reminder.

>
> On 11/20/20 12:25, Gustavo A. R. Silva wrote:
> > In preparation to enable -Wimplicit-fallthrough for Clang, fix multiple
> > warnings by explicitly adding multiple break statements 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 <[email protected]>

Applied to
git://git.kernel.org/pub/scm/linux/kernel/git/zohar/linux-integrity.git
next-integrity

thanks,

Mimi

2021-04-20 22:21:35

by Gustavo A. R. Silva

[permalink] [raw]
Subject: Re: [PATCH 010/141] ima: Fix fall-through warnings for Clang



On 4/20/21 16:32, Mimi Zohar wrote:

> Applied to
> git://git.kernel.org/pub/scm/linux/kernel/git/zohar/linux-integrity.git
> next-integrity

Thanks, Mimi.

--
Gustavo