Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2119236imj; Fri, 8 Feb 2019 12:56:02 -0800 (PST) X-Google-Smtp-Source: AHgI3Ib6gfoMxCnOsNsQBsh9MGAnjde7rxGo+Rw94VhGauSMDuUtTK+zRGFLGadElOvbRvHGCBNU X-Received: by 2002:a63:e655:: with SMTP id p21mr7198824pgj.70.1549659362094; Fri, 08 Feb 2019 12:56:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549659362; cv=none; d=google.com; s=arc-20160816; b=JnO2xaccts/utmng5pjj0aFyDdUwsolYfhxLHQjUx2CSY2LrY0ImFPumLHORjKpSOu pEdDQviO5IUWSph+0d5I/3N0/0nMRTipH03aDCyTGmBiGgQXOEtqN0hQRqJqsrG5h0tN h2RnytWbj+Fu9gVxM36IRfq8o4wgkzH8u7H9wEn2lOnUCchsvt2ub8IFL5PNC+mfyAGD eG+6snIayt9gZSFPhPEZxt6ouXaxhyZcZ3GZ6guLSwP8Nhk8chSotCDtTPQGd0UZYL66 ATXhogICmaJd6YRteYSAwx2auZMVrFtFgXYMNhBxzf4eePZ7sKdnBwq/SY60+a7LudEU h8qA== 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=iJbYJrT/T3ZOmHRckhwg4o3V7mN5nLsa1ruZFcq4ML8=; b=TIIK2mLSfRMdq/6TDSS1r5WzxHqAme0RkbvbwedDvsNDrRPa9TuIDH3sWQtalpLmso OG4vaetj+Yrf9HAvQI4FIowYHyHIrG9vj8gZE/9gLYtiebfL4Ln/2R4o1BDeik27VIvI j/5nI7XGkHBj6DQpjq5FzXt1ReRydtglZz9XxbW0PVNkETP4+djS+Q74w8xhGtS9b6Vj bQjkcsOlL68hP2K4TBFYmuyDkiht6k/MntnBAybXZGyF0OwwoTA0/u5ZWk2ybmPQfTHV D6TS0+617EEIiPgq9c1FLNvAmAmjUXSOgK5sXGSKRqq8RDuXWHIem9JYzIOLn+erw/wM PSeA== 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 d22si1403464pgi.65.2019.02.08.12.55.45; Fri, 08 Feb 2019 12:56:02 -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 S1727041AbfBHUy5 (ORCPT + 99 others); Fri, 8 Feb 2019 15:54:57 -0500 Received: from gateway30.websitewelcome.com ([50.116.127.1]:15591 "EHLO gateway30.websitewelcome.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726978AbfBHUy5 (ORCPT ); Fri, 8 Feb 2019 15:54:57 -0500 Received: from cm11.websitewelcome.com (cm11.websitewelcome.com [100.42.49.5]) by gateway30.websitewelcome.com (Postfix) with ESMTP id C41325125 for ; Fri, 8 Feb 2019 14:54:55 -0600 (CST) Received: from gator4166.hostgator.com ([108.167.133.22]) by cmsmtp with SMTP id sDAlgcldpdnCesDAlgcf7f; Fri, 08 Feb 2019 14:54:55 -0600 X-Authority-Reason: nr=8 Received: from [189.250.49.191] (port=34656 helo=embeddedor) by gator4166.hostgator.com with esmtpa (Exim 4.91) (envelope-from ) id 1gsDAk-001tFR-R9; Fri, 08 Feb 2019 14:54:55 -0600 Date: Fri, 8 Feb 2019 14:54:53 -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 v2] security: mark expected switch fall-throughs and add a missing break Message-ID: <20190208205453.GA3232@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.49.191 X-Source-L: No X-Exim-ID: 1gsDAk-001tFR-R9 X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: (embeddedor) [189.250.49.191]:34656 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_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 Acked-by: Casey Schaufler Signed-off-by: Gustavo A. R. Silva --- 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(-) diff --git a/security/apparmor/domain.c b/security/apparmor/domain.c index 3b266a438776..ca2dccf5b445 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..5fb7127bbe68 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; + break; 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 26fa9d9723f6..e0cc323f948f 100644 --- a/security/integrity/ima/ima_policy.c +++ b/security/integrity/ima/ima_policy.c @@ -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); 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 587dc06eba33..5c1613519d5a 100644 --- a/security/smack/smack_lsm.c +++ b/security/smack/smack_lsm.c @@ -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. -- 2.20.1