Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp23214imu; Thu, 24 Jan 2019 18:57:51 -0800 (PST) X-Google-Smtp-Source: ALg8bN7LiG3rgiVWt7ZxWJaFWiDRfj2h5ht0Ri4zrkf6h+7mFE8iCLvVXs9e6UWByhpygGCuv1jr X-Received: by 2002:a63:e344:: with SMTP id o4mr8215615pgj.158.1548385071771; Thu, 24 Jan 2019 18:57:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548385071; cv=none; d=google.com; s=arc-20160816; b=UkTPPxauUo5vydWJO3acn5s76akASwldAw5s4okqCoMYu2UlOvgYF4Pix35o8tGWXU zGV0+ly+CN/LpNkU0M44aPOU7lFxhLcqVv3fIBEkTwO7GhbSybb35hzn6vqS7VJrsimQ CjWG+FGj48hYh3anwI0dH0SC+qeDVY09i34T2cjr57hfAtEgSfWIdoegmqgsMvhBO1i+ ftXvoJukCE3Kl6T6P4YLvgersJRkDq8boJ6OTMwIY1gsiXRkvL/MyxUVHPb3jH1FFf9/ iyabRcLMV3ADz3HAMIv47LMBV/IT8NjHd5D20xCAKrO23jZT4zp8lzBIGnMRwZ1P7STm mq1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:content-disposition :mime-version:message-id:subject:cc:to:from:date; bh=NcMLDBPXGuajctvPT9W6H6i/jHl2heqWwJzBGPyMMd0=; b=WAfQL694yAd4R8BtSnaNS/5BOA3IFTguEZpAgBbWbCtfO+2boIv+ds5acmxwqOmp2u ABZLGSC8lrkw6EklOzACRQDOTfZrlyAL9ZqgJrQ4V8IiwqA++gBUsn1W/tms7HCuOWdL Y6UsmRkE/TcAROOnlMHI9v4wPw/3cwE85Aplddyk64qfm9v+hWCRm6fcz6ahT8BkidEd zFl6zhEVH1lLvVxJ1rsC6336UoWTN44Ejrj+KKgo0M1vkWTB5v4bkB7qSf6Tjg+ufjGB vJi/U9YXUZU0Tv404p+orTOt6Y9Hbs9em5cONpFV7CnWbFNNpROnghe5WoKAmXmGXsxK 8Csg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e6si6858436pgp.504.2019.01.24.18.57.33; Thu, 24 Jan 2019 18:57:51 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728897AbfAYC4m (ORCPT + 99 others); Thu, 24 Jan 2019 21:56:42 -0500 Received: from gateway34.websitewelcome.com ([192.185.148.222]:36567 "EHLO gateway34.websitewelcome.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725991AbfAYC4m (ORCPT ); Thu, 24 Jan 2019 21:56:42 -0500 Received: from cm17.websitewelcome.com (cm17.websitewelcome.com [100.42.49.20]) by gateway34.websitewelcome.com (Postfix) with ESMTP id 096B750F973 for ; Thu, 24 Jan 2019 20:56:41 -0600 (CST) Received: from gator4166.hostgator.com ([108.167.133.22]) by cmsmtp with SMTP id mrfcgkrg890onmrfdgBtHy; Thu, 24 Jan 2019 20:56:41 -0600 X-Authority-Reason: nr=8 Received: from [189.250.130.205] (port=33912 helo=embeddedor) by gator4166.hostgator.com with esmtpa (Exim 4.91) (envelope-from ) id 1gmrfc-000vHu-2W; Thu, 24 Jan 2019 20:56:40 -0600 Date: Thu, 24 Jan 2019 20:56:39 -0600 From: "Gustavo A. R. Silva" To: John Johansen , James Morris , "Serge E. Hallyn" , Mimi Zohar , Dmitry Kasatkin , Casey Schaufler Cc: linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, linux-integrity@vger.kernel.org, "Gustavo A. R. Silva" Subject: [PATCH] security: mark expected switch fall-throughs Message-ID: <20190125025639.GA13946@embeddedor> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.9.4 (2018-02-28) X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator4166.hostgator.com X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - embeddedor.com X-BWhitelist: no X-Source-IP: 189.250.130.205 X-Source-L: No X-Exim-ID: 1gmrfc-000vHu-2W X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: (embeddedor) [189.250.130.205]:33912 X-Source-Auth: gustavo@embeddedor.com X-Email-Count: 8 X-Source-Cap: Z3V6aWRpbmU7Z3V6aWRpbmU7Z2F0b3I0MTY2Lmhvc3RnYXRvci5jb20= X-Local-Domain: yes Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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_appraise.c:116:26: warning: this statement may fall through [-Wimplicit-fallthrough=] 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 This patch is part of the ongoing efforts to enabling -Wimplicit-fallthrough. Signed-off-by: Gustavo A. R. Silva --- 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(-) diff --git a/security/apparmor/domain.c b/security/apparmor/domain.c index 726910bba84b..c7c619578095 100644 --- a/security/apparmor/domain.c +++ b/security/apparmor/domain.c @@ -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 */ diff --git a/security/integrity/ima/ima_appraise.c b/security/integrity/ima/ima_appraise.c index a2baa85ea2f5..57daf30fb7d4 100644 --- a/security/integrity/ima/ima_appraise.c +++ b/security/integrity/ima/ima_appraise.c @@ -114,6 +114,7 @@ static void ima_set_cache_status(struct integrity_iint_cache *iint, break; case CREDS_CHECK: iint->ima_creds_status = status; + /* fall through */ case FILE_CHECK: case POST_SETATTR: iint->ima_file_status = status; diff --git a/security/integrity/ima/ima_policy.c b/security/integrity/ima/ima_policy.c index 8bc8a1c8cb3f..122797023bdb 100644 --- a/security/integrity/ima/ima_policy.c +++ b/security/integrity/ima/ima_policy.c @@ -938,10 +938,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) || @@ -970,9 +972,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); diff --git a/security/integrity/ima/ima_template_lib.c b/security/integrity/ima/ima_template_lib.c index 43752002c222..513b457ae900 100644 --- a/security/integrity/ima/ima_template_lib.c +++ b/security/integrity/ima/ima_template_lib.c @@ -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) diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c index fa98394a40d0..127aa6c58e34 100644 --- a/security/smack/smack_lsm.c +++ b/security/smack/smack_lsm.c @@ -3391,13 +3391,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. -- 2.20.1