Skip to content

Commit 09186e5

Browse files
GustavoARSilvaJames Morris
authored andcommitted
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=] Acked-by: John Johansen <john.johansen@canonical.com> Acked-by: Casey Schaufler <casey@schaufler-ca.com> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com> Acked-by: Mimi Zohar <zohar@linux.ibm.com> Signed-off-by: James Morris <james.morris@microsoft.com>
1 parent 861f4bc commit 09186e5

5 files changed

Lines changed: 8 additions & 3 deletions

File tree

‎security/apparmor/domain.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@ static struct aa_label *x_to_label(struct aa_profile *profile,
572572
stack = NULL;
573573
break;
574574
}
575-
/* fall through to X_NAME */
575+
/* fall through - to X_NAME */
576576
case AA_X_NAME:
577577
if (xindex & AA_X_CHILD)
578578
/* released by caller */

‎security/integrity/ima/ima_appraise.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ static void ima_set_cache_status(struct integrity_iint_cache *iint,
114114
break;
115115
case CREDS_CHECK:
116116
iint->ima_creds_status = status;
117+
break;
117118
case FILE_CHECK:
118119
case POST_SETATTR:
119120
iint->ima_file_status = status;

‎security/integrity/ima/ima_policy.c‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -938,10 +938,12 @@ static int ima_parse_rule(char *rule, struct ima_rule_entry *entry)
938938
case Opt_uid_gt:
939939
case Opt_euid_gt:
940940
entry->uid_op = &uid_gt;
941+
/* fall through */
941942
case Opt_uid_lt:
942943
case Opt_euid_lt:
943944
if ((token == Opt_uid_lt) || (token == Opt_euid_lt))
944945
entry->uid_op = &uid_lt;
946+
/* fall through */
945947
case Opt_uid_eq:
946948
case Opt_euid_eq:
947949
uid_token = (token == Opt_uid_eq) ||
@@ -970,9 +972,11 @@ static int ima_parse_rule(char *rule, struct ima_rule_entry *entry)
970972
break;
971973
case Opt_fowner_gt:
972974
entry->fowner_op = &uid_gt;
975+
/* fall through */
973976
case Opt_fowner_lt:
974977
if (token == Opt_fowner_lt)
975978
entry->fowner_op = &uid_lt;
979+
/* fall through */
976980
case Opt_fowner_eq:
977981
ima_log_string_op(ab, "fowner", args[0].from,
978982
entry->fowner_op);

‎security/integrity/ima/ima_template_lib.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ static void ima_show_template_data_ascii(struct seq_file *m,
8383
/* skip ':' and '\0' */
8484
buf_ptr += 2;
8585
buflen -= buf_ptr - field_data->data;
86+
/* fall through */
8687
case DATA_FMT_DIGEST:
8788
case DATA_FMT_HEX:
8889
if (!buflen)

‎security/smack/smack_lsm.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3293,13 +3293,12 @@ static void smack_d_instantiate(struct dentry *opt_dentry, struct inode *inode)
32933293
*/
32943294
final = &smack_known_star;
32953295
/*
3296-
* Fall through.
3297-
*
32983296
* If a smack value has been set we want to use it,
32993297
* but since tmpfs isn't giving us the opportunity
33003298
* to set mount options simulate setting the
33013299
* superblock default.
33023300
*/
3301+
/* Fall through */
33033302
default:
33043303
/*
33053304
* This isn't an understood special case.

0 commit comments

Comments
 (0)