security: mark expected switch fall-throughs and add a missing break
Subsystems (6)
PATCH v2 1/1 security: mark expected switch fall-throughs and add a missing break
In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through.
This patch fixes the following warnings:
security/integrity/ima/ima_template_lib.c:85:10: warning: this statement may fall through [-Wimplicit-fallthrough=] security/integrity/ima/ima_policy.c:940:18: warning: this statement may fall through [-Wimplicit-fallthrough=] security/integrity/ima/ima_policy.c:943:7: warning: this statement may fall through [-Wimplicit-fallthrough=] security/integrity/ima/ima_policy.c:972:21: warning: this statement may fall through [-Wimplicit-fallthrough=] security/integrity/ima/ima_policy.c:974:7: warning: this statement may fall through [-Wimplicit-fallthrough=] security/smack/smack_lsm.c:3391:9: warning: this statement may fall through [-Wimplicit-fallthrough=] security/apparmor/domain.c:569:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
Warning level 3 was used: -Wimplicit-fallthrough=3
Also, add a missing break statement to fix the following warning:
security/integrity/ima/ima_appraise.c:116:26: warning: this statement may fall through [-Wimplicit-fallthrough=]
---
Changes in v2:
- Update Subject.
- Integrate a missing break in switch fix by Mimi Zohar.
security/apparmor/domain.c | 2 +- security/integrity/ima/ima_appraise.c | 1 + security/integrity/ima/ima_policy.c | 4 ++++ security/integrity/ima/ima_template_lib.c | 1 + security/smack/smack_lsm.c | 3 +-- 5 files changed, 8 insertions(+), 3 deletions(-)
security/apparmor/domain.c +1 -1
@@ -572,7 +572,7 @@ static struct aa_label *x_to_label(struct aa_profile *profile, stack =NULL ;break ; } -/* fall through to X_NAME */ +/* fall through - to X_NAME */ case AA_X_NAME :if (xindex &AA_X_CHILD )/* released by caller */
security/integrity/ima/ima_appraise.c +1 -0
@@ -114,6 +114,7 @@ static void ima_set_cache_status(struct integrity_iint_cache *iint,break ;case CREDS_CHECK : iint->ima_creds_status = status; +break ;case FILE_CHECK :case POST_SETATTR : iint->ima_file_status = status;
security/integrity/ima/ima_policy.c +4 -0
@@ -936,10 +936,12 @@ static int ima_parse_rule(char *rule, struct ima_rule_entry *entry)case Opt_uid_gt:case Opt_euid_gt: entry->uid_op = &uid_gt; +/* fall through */ case Opt_uid_lt:case Opt_euid_lt:if ((token == Opt_uid_lt) || (token == Opt_euid_lt)) entry->uid_op = &uid_lt; +/* fall through */ case Opt_uid_eq:case Opt_euid_eq: uid_token = (token == Opt_uid_eq) ||
@@ -968,9 +970,11 @@ static int ima_parse_rule(char *rule, struct ima_rule_entry *entry)break ;case Opt_fowner_gt: entry->fowner_op = &uid_gt; +/* fall through */ case Opt_fowner_lt:if (token == Opt_fowner_lt) entry->fowner_op = &uid_lt; +/* fall through */ case Opt_fowner_eq:ima_log_string_op (ab,"fowner" , args[0 ].from, entry->fowner_op);
security/integrity/ima/ima_template_lib.c +1 -0
@@ -83,6 +83,7 @@ static void ima_show_template_data_ascii(struct seq_file *m,/* skip ':' and '\0' */ buf_ptr +=2 ; buflen -= buf_ptr - field_data->data; +/* fall through */ case DATA_FMT_DIGEST :case DATA_FMT_HEX :if (!buflen)
security/smack/smack_lsm.c +1 -2
@@ -3380,13 +3380,12 @@ static void smack_d_instantiate(struct dentry *opt_dentry, struct inode *inode)*/ final = &smack_known_star;/* -* Fall through. -* * If a smack value has been set we want to use it, * but since tmpfs isn't giving us the opportunity * to set mount options simulate setting the * superblock default. */ +/* Fall through */ default :/* * This isn't an understood special case.
Signature · 1 line
2.20.1
Quoted 15 lines · Gustavo A. R. Silva
In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through.
This patch fixes the following warnings:
security/integrity/ima/ima_template_lib.c:85:10: warning: this statement may fall through [-Wimplicit-fallthrough=]security/integrity/ima/ima_policy.c:940:18: warning: this statement may fall through [-Wimplicit-fallthrough=]security/integrity/ima/ima_policy.c:943:7: warning: this statement may fall through [-Wimplicit-fallthrough=]security/integrity/ima/ima_policy.c:972:21: warning: this statement may fall through [-Wimplicit-fallthrough=]security/integrity/ima/ima_policy.c:974:7: warning: this statement may fall through [-Wimplicit-fallthrough=]security/smack/smack_lsm.c:3391:9: warning: this statement may fall through [-Wimplicit-fallthrough=]security/apparmor/domain.c:569:6: warning: this statement may fall through [-Wimplicit-fallthrough=]Warning level 3 was used: -Wimplicit-fallthrough=3
Quoted 7 lines
Also, add a missing break statement to fix the following warning:
security/integrity/ima/ima_appraise.c:116:26: warning: this statement may fall through [-Wimplicit-fallthrough=]Acked-by John Johansen <[email protected]>Acked-by Casey Schaufler <[email protected]>Signed-off-by Gustavo A. R. Silva <[email protected]>
Quoted 97 lines
---
Changes in v2:
- Update Subject.
- Integrate a missing break in switch fix by Mimi Zohar.security/apparmor/domain.c | 2 +- security/integrity/ima/ima_appraise.c | 1 + security/integrity/ima/ima_policy.c | 4 ++++ security/integrity/ima/ima_template_lib.c | 1 + security/smack/smack_lsm.c | 3 +-- 5 files changed, 8 insertions(+), 3 deletions(-)security/apparmor/domain.c +1
-1@@ -572,7 +572,7 @@ static struct aa_label *x_to_label(struct aa_profile *profile, stack =NULL ;break ; } -/* fall through to X_NAME */ +/* fall through - to X_NAME */ case AA_X_NAME :if (xindex &AA_X_CHILD )/* released by caller */ security/integrity/ima/ima_appraise.c +1
-0@@ -114,6 +114,7 @@ static void ima_set_cache_status(struct integrity_iint_cache *iint,break ;case CREDS_CHECK : iint->ima_creds_status = status; +break ;case FILE_CHECK :case POST_SETATTR : iint->ima_file_status = status;security/integrity/ima/ima_policy.c +4
-0@@ -936,10 +936,12 @@ static int ima_parse_rule(char *rule, struct ima_rule_entry *entry)case Opt_uid_gt:case Opt_euid_gt: entry->uid_op = &uid_gt; +/* fall through */ case Opt_uid_lt:case Opt_euid_lt:if ((token == Opt_uid_lt) || (token == Opt_euid_lt)) entry->uid_op = &uid_lt; +/* fall through */ case Opt_uid_eq:case Opt_euid_eq: uid_token = (token == Opt_uid_eq) ||@@ -968,9 +970,11 @@ static int ima_parse_rule(char *rule, struct ima_rule_entry *entry)break ;case Opt_fowner_gt: entry->fowner_op = &uid_gt; +/* fall through */ case Opt_fowner_lt:if (token == Opt_fowner_lt) entry->fowner_op = &uid_lt; +/* fall through */ case Opt_fowner_eq:ima_log_string_op (ab,"fowner" , args[0 ].from, entry->fowner_op);security/integrity/ima/ima_template_lib.c +1
-0@@ -83,6 +83,7 @@ static void ima_show_template_data_ascii(struct seq_file *m,/* skip ':' and '\0' */ buf_ptr +=2 ; buflen -= buf_ptr - field_data->data; +/* fall through */ case DATA_FMT_DIGEST :case DATA_FMT_HEX :if (!buflen)security/smack/smack_lsm.c +1
-2@@ -3380,13 +3380,12 @@ static void smack_d_instantiate(struct dentry *opt_dentry, struct inode *inode)*/ final = &smack_known_star;/* -* Fall through. -* * If a smack value has been set we want to use it, * but since tmpfs isn't giving us the opportunity * to set mount options simulate setting the * superblock default. */ +/* Fall through */ default :/* * This isn't an understood special case.
Quoted 18 lines · Mimi Zohar
Quoted 17 lines · Gustavo A. R. Silva
In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through.
This patch fixes the following warnings:
security/integrity/ima/ima_template_lib.c:85:10: warning: this statement may fall through [-Wimplicit-fallthrough=]security/integrity/ima/ima_policy.c:940:18: warning: this statement may fall through [-Wimplicit-fallthrough=]security/integrity/ima/ima_policy.c:943:7: warning: this statement may fall through [-Wimplicit-fallthrough=]security/integrity/ima/ima_policy.c:972:21: warning: this statement may fall through [-Wimplicit-fallthrough=]security/integrity/ima/ima_policy.c:974:7: warning: this statement may fall through [-Wimplicit-fallthrough=]security/smack/smack_lsm.c:3391:9: warning: this statement may fall through [-Wimplicit-fallthrough=]security/apparmor/domain.c:569:6: warning: this statement may fall through [-Wimplicit-fallthrough=]Warning level 3 was used: -Wimplicit-fallthrough=3
Also, add a missing break statement to fix the following warning:
Quoted 8 lines
Quoted 5 lines
security/integrity/ima/ima_appraise.c:116:26: warning: this statement may fall through [-Wimplicit-fallthrough=]Acked-by John Johansen <[email protected]>Acked-by Casey Schaufler <[email protected]>Signed-off-by Gustavo A. R. Silva <[email protected]>Acked-by Mimi Zohar <[email protected]>
Thanks, Mimi.
--
Gustavo
Quoted 98 lines
Quoted 97 lines
---
Changes in v2:
- Update Subject.
- Integrate a missing break in switch fix by Mimi Zohar.security/apparmor/domain.c | 2 +- security/integrity/ima/ima_appraise.c | 1 + security/integrity/ima/ima_policy.c | 4 ++++ security/integrity/ima/ima_template_lib.c | 1 + security/smack/smack_lsm.c | 3 +-- 5 files changed, 8 insertions(+), 3 deletions(-)security/apparmor/domain.c +1
-1@@ -572,7 +572,7 @@ static struct aa_label *x_to_label(struct aa_profile *profile, stack =NULL ;break ; } -/* fall through to X_NAME */ +/* fall through - to X_NAME */ case AA_X_NAME :if (xindex &AA_X_CHILD )/* released by caller */ security/integrity/ima/ima_appraise.c +1
-0@@ -114,6 +114,7 @@ static void ima_set_cache_status(struct integrity_iint_cache *iint,break ;case CREDS_CHECK : iint->ima_creds_status = status; +break ;case FILE_CHECK :case POST_SETATTR : iint->ima_file_status = status;security/integrity/ima/ima_policy.c +4
-0@@ -936,10 +936,12 @@ static int ima_parse_rule(char *rule, struct ima_rule_entry *entry)case Opt_uid_gt:case Opt_euid_gt: entry->uid_op = &uid_gt; +/* fall through */ case Opt_uid_lt:case Opt_euid_lt:if ((token == Opt_uid_lt) || (token == Opt_euid_lt)) entry->uid_op = &uid_lt; +/* fall through */ case Opt_uid_eq:case Opt_euid_eq: uid_token = (token == Opt_uid_eq) ||@@ -968,9 +970,11 @@ static int ima_parse_rule(char *rule, struct ima_rule_entry *entry)break ;case Opt_fowner_gt: entry->fowner_op = &uid_gt; +/* fall through */ case Opt_fowner_lt:if (token == Opt_fowner_lt) entry->fowner_op = &uid_lt; +/* fall through */ case Opt_fowner_eq:ima_log_string_op (ab,"fowner" , args[0 ].from, entry->fowner_op);security/integrity/ima/ima_template_lib.c +1
-0@@ -83,6 +83,7 @@ static void ima_show_template_data_ascii(struct seq_file *m,/* skip ':' and '\0' */ buf_ptr +=2 ; buflen -= buf_ptr - field_data->data; +/* fall through */ case DATA_FMT_DIGEST :case DATA_FMT_HEX :if (!buflen)security/smack/smack_lsm.c +1
-2@@ -3380,13 +3380,12 @@ static void smack_d_instantiate(struct dentry *opt_dentry, struct inode *inode)*/ final = &smack_known_star;/* -* Fall through. -* * If a smack value has been set we want to use it, * but since tmpfs isn't giving us the opportunity * to set mount options simulate setting the * superblock default. */ +/* Fall through */ default :/* * This isn't an understood special case.
Hi James,
I wonder if you can take this, please.
Thanks
--
Gustavo
Quoted 133 lines · Gustavo A. R. Silva
Quoted 18 lines · Mimi Zohar
Quoted 17 lines · Gustavo A. R. Silva
In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through.
This patch fixes the following warnings:
security/integrity/ima/ima_template_lib.c:85:10: warning: this statement may fall through [-Wimplicit-fallthrough=]security/integrity/ima/ima_policy.c:940:18: warning: this statement may fall through [-Wimplicit-fallthrough=]security/integrity/ima/ima_policy.c:943:7: warning: this statement may fall through [-Wimplicit-fallthrough=]security/integrity/ima/ima_policy.c:972:21: warning: this statement may fall through [-Wimplicit-fallthrough=]security/integrity/ima/ima_policy.c:974:7: warning: this statement may fall through [-Wimplicit-fallthrough=]security/smack/smack_lsm.c:3391:9: warning: this statement may fall through [-Wimplicit-fallthrough=]security/apparmor/domain.c:569:6: warning: this statement may fall through [-Wimplicit-fallthrough=]Warning level 3 was used: -Wimplicit-fallthrough=3
Also, add a missing break statement to fix the following warning:
Quoted 8 lines
Quoted 5 lines
security/integrity/ima/ima_appraise.c:116:26: warning: this statement may fall through [-Wimplicit-fallthrough=]Acked-by John Johansen <[email protected]>Acked-by Casey Schaufler <[email protected]>Signed-off-by Gustavo A. R. Silva <[email protected]>Acked-by Mimi Zohar <[email protected]>Thanks, Mimi.
--
GustavoQuoted 98 lines
Quoted 97 lines
---
Changes in v2:
- Update Subject.
- Integrate a missing break in switch fix by Mimi Zohar.security/apparmor/domain.c | 2 +- security/integrity/ima/ima_appraise.c | 1 + security/integrity/ima/ima_policy.c | 4 ++++ security/integrity/ima/ima_template_lib.c | 1 + security/smack/smack_lsm.c | 3 +-- 5 files changed, 8 insertions(+), 3 deletions(-)security/apparmor/domain.c +1
-1@@ -572,7 +572,7 @@ static struct aa_label *x_to_label(struct aa_profile *profile, stack =NULL ;break ; } -/* fall through to X_NAME */ +/* fall through - to X_NAME */ case AA_X_NAME :if (xindex &AA_X_CHILD )/* released by caller */ security/integrity/ima/ima_appraise.c +1
-0@@ -114,6 +114,7 @@ static void ima_set_cache_status(struct integrity_iint_cache *iint,break ;case CREDS_CHECK : iint->ima_creds_status = status; +break ;case FILE_CHECK :case POST_SETATTR : iint->ima_file_status = status;security/integrity/ima/ima_policy.c +4
-0@@ -936,10 +936,12 @@ static int ima_parse_rule(char *rule, struct ima_rule_entry *entry)case Opt_uid_gt:case Opt_euid_gt: entry->uid_op = &uid_gt; +/* fall through */ case Opt_uid_lt:case Opt_euid_lt:if ((token == Opt_uid_lt) || (token == Opt_euid_lt)) entry->uid_op = &uid_lt; +/* fall through */ case Opt_uid_eq:case Opt_euid_eq: uid_token = (token == Opt_uid_eq) ||@@ -968,9 +970,11 @@ static int ima_parse_rule(char *rule, struct ima_rule_entry *entry)break ;case Opt_fowner_gt: entry->fowner_op = &uid_gt; +/* fall through */ case Opt_fowner_lt:if (token == Opt_fowner_lt) entry->fowner_op = &uid_lt; +/* fall through */ case Opt_fowner_eq:ima_log_string_op (ab,"fowner" , args[0 ].from, entry->fowner_op);security/integrity/ima/ima_template_lib.c +1
-0@@ -83,6 +83,7 @@ static void ima_show_template_data_ascii(struct seq_file *m,/* skip ':' and '\0' */ buf_ptr +=2 ; buflen -= buf_ptr - field_data->data; +/* fall through */ case DATA_FMT_DIGEST :case DATA_FMT_HEX :if (!buflen)security/smack/smack_lsm.c +1
-2@@ -3380,13 +3380,12 @@ static void smack_d_instantiate(struct dentry *opt_dentry, struct inode *inode)*/ final = &smack_known_star;/* -* Fall through. -* * If a smack value has been set we want to use it, * but since tmpfs isn't giving us the opportunity * to set mount options simulate setting the * superblock default. */ +/* Fall through */ default :/* * This isn't an understood special case.
James Morris
maintainerQuoted 3 lines · Gustavo A. R. Silva
Hi James,
I wonder if you can take this, please.
Ok -- I had thought you were sending all of these upstream across the board.
Quoted 140 lines
Thanks
--
GustavoQuoted 133 lines · Gustavo A. R. Silva
Quoted 18 lines · Mimi Zohar
Quoted 17 lines · Gustavo A. R. Silva
In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through.
This patch fixes the following warnings:
security/integrity/ima/ima_template_lib.c:85:10: warning: this statement may fall through [-Wimplicit-fallthrough=]security/integrity/ima/ima_policy.c:940:18: warning: this statement may fall through [-Wimplicit-fallthrough=]security/integrity/ima/ima_policy.c:943:7: warning: this statement may fall through [-Wimplicit-fallthrough=]security/integrity/ima/ima_policy.c:972:21: warning: this statement may fall through [-Wimplicit-fallthrough=]security/integrity/ima/ima_policy.c:974:7: warning: this statement may fall through [-Wimplicit-fallthrough=]security/smack/smack_lsm.c:3391:9: warning: this statement may fall through [-Wimplicit-fallthrough=]security/apparmor/domain.c:569:6: warning: this statement may fall through [-Wimplicit-fallthrough=]Warning level 3 was used: -Wimplicit-fallthrough=3
Also, add a missing break statement to fix the following warning:
Quoted 8 lines
Quoted 5 lines
security/integrity/ima/ima_appraise.c:116:26: warning: this statement may fall through [-Wimplicit-fallthrough=]Acked-by John Johansen <[email protected]>Acked-by Casey Schaufler <[email protected]>Signed-off-by Gustavo A. R. Silva <[email protected]>Acked-by Mimi Zohar <[email protected]>Thanks, Mimi.
--
GustavoQuoted 98 lines
Quoted 97 lines
---
Changes in v2:
- Update Subject.
- Integrate a missing break in switch fix by Mimi Zohar.security/apparmor/domain.c | 2 +- security/integrity/ima/ima_appraise.c | 1 + security/integrity/ima/ima_policy.c | 4 ++++ security/integrity/ima/ima_template_lib.c | 1 + security/smack/smack_lsm.c | 3 +-- 5 files changed, 8 insertions(+), 3 deletions(-)security/apparmor/domain.c +1
-1@@ -572,7 +572,7 @@ static struct aa_label *x_to_label(struct aa_profile *profile, stack =NULL ;break ; } -/* fall through to X_NAME */ +/* fall through - to X_NAME */ case AA_X_NAME :if (xindex &AA_X_CHILD )/* released by caller */ security/integrity/ima/ima_appraise.c +1
-0@@ -114,6 +114,7 @@ static void ima_set_cache_status(struct integrity_iint_cache *iint,break ;case CREDS_CHECK : iint->ima_creds_status = status; +break ;case FILE_CHECK :case POST_SETATTR : iint->ima_file_status = status;security/integrity/ima/ima_policy.c +4
-0@@ -936,10 +936,12 @@ static int ima_parse_rule(char *rule, struct ima_rule_entry *entry)case Opt_uid_gt:case Opt_euid_gt: entry->uid_op = &uid_gt; +/* fall through */ case Opt_uid_lt:case Opt_euid_lt:if ((token == Opt_uid_lt) || (token == Opt_euid_lt)) entry->uid_op = &uid_lt; +/* fall through */ case Opt_uid_eq:case Opt_euid_eq: uid_token = (token == Opt_uid_eq) ||@@ -968,9 +970,11 @@ static int ima_parse_rule(char *rule, struct ima_rule_entry *entry)break ;case Opt_fowner_gt: entry->fowner_op = &uid_gt; +/* fall through */ case Opt_fowner_lt:if (token == Opt_fowner_lt) entry->fowner_op = &uid_lt; +/* fall through */ case Opt_fowner_eq:ima_log_string_op (ab,"fowner" , args[0 ].from, entry->fowner_op);security/integrity/ima/ima_template_lib.c +1
-0@@ -83,6 +83,7 @@ static void ima_show_template_data_ascii(struct seq_file *m,/* skip ':' and '\0' */ buf_ptr +=2 ; buflen -= buf_ptr - field_data->data; +/* fall through */ case DATA_FMT_DIGEST :case DATA_FMT_HEX :if (!buflen)security/smack/smack_lsm.c +1
-2@@ -3380,13 +3380,12 @@ static void smack_d_instantiate(struct dentry *opt_dentry, struct inode *inode)*/ final = &smack_known_star;/* -* Fall through. -* * If a smack value has been set we want to use it, * but since tmpfs isn't giving us the opportunity * to set mount options simulate setting the * superblock default. */ +/* Fall through */ default :/* * This isn't an understood special case.
Signature · 2 lines
James Morris <[email protected]>
Quoted 10 lines · James Morris
Quoted 3 lines · Gustavo A. R. Silva
Hi James,
I wonder if you can take this, please.
Ok -- I had thought you were sending all of these upstream across the board.
Yeah, I'm only doing that in cases where patches are being ignored.
Thanks
--
Gustavo
James Morris
maintainerQuoted 5 lines · Gustavo A. R. Silva
In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through.
This patch fixes the following warnings:
Quoted 8 lines
security/integrity/ima/ima_template_lib.c:85:10: warning: this statement may fall through [-Wimplicit-fallthrough=]security/integrity/ima/ima_policy.c:940:18: warning: this statement may fall through [-Wimplicit-fallthrough=]security/integrity/ima/ima_policy.c:943:7: warning: this statement may fall through [-Wimplicit-fallthrough=]security/integrity/ima/ima_policy.c:972:21: warning: this statement may fall through [-Wimplicit-fallthrough=]security/integrity/ima/ima_policy.c:974:7: warning: this statement may fall through [-Wimplicit-fallthrough=]security/smack/smack_lsm.c:3391:9: warning: this statement may fall through [-Wimplicit-fallthrough=]security/apparmor/domain.c:569:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
Applied togit://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security.git next-general
Signature · 2 lines
James Morris <[email protected]>