From patchwork Fri May 19 17:09:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthias Kaehlcke X-Patchwork-Id: 9737779 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 18997601C2 for ; Fri, 19 May 2017 17:09:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F2B9E28535 for ; Fri, 19 May 2017 17:09:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E538828537; Fri, 19 May 2017 17:09:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.4 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 692C628535 for ; Fri, 19 May 2017 17:09:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750810AbdESRJm (ORCPT ); Fri, 19 May 2017 13:09:42 -0400 Received: from mail-pf0-f174.google.com ([209.85.192.174]:33081 "EHLO mail-pf0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750748AbdESRJm (ORCPT ); Fri, 19 May 2017 13:09:42 -0400 Received: by mail-pf0-f174.google.com with SMTP id e193so42689508pfh.0 for ; Fri, 19 May 2017 10:09:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=NWLCMjX1oGZfizvMDFG3/UsPXotaV/Isgd8vJdYm5is=; b=je/wgks3iI7QZzsEW8+0mTQ67FFetBVMyLgFA1TyGT1IDRIosX/6h7M6BE/Hl2E/f3 hMqzXJgHM8jfi19zKpWHlxNmzbzqmCPHM8B0Z1v7URrG9E1wWjnwYBdzc4oK0QVyIPTy XxNHqb27gOPiCebGU1ar8G7LHFa9Z+vFPNbZaHpTIdji/gbBxE7BzXxDLOA97JghhLpN bABh48KIFiF9SQzAZO5sdGsD4d6RNbsaMdP9vWW8pqhV7WyAAY8J5stb61jlyyzIKyh7 STQd6rEL9h88acJFJ98h+RqV/KdXMLFrByN62OAW8sz0UFpGMQQ/UPtEo1sfucGhbll/ h3kw== X-Gm-Message-State: AODbwcCXQwW5QkOo7CbTYK+2zwu/ocjwv8DRg54ibWi5wLkvxAcgS/Ki HgXlvT/a3bOSig0f X-Received: by 10.84.171.195 with SMTP id l61mr12573163plb.147.1495213781253; Fri, 19 May 2017 10:09:41 -0700 (PDT) Received: from mka.mtv.corp.google.com ([172.22.64.162]) by smtp.gmail.com with ESMTPSA id q27sm16976045pfk.4.2017.05.19.10.09.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 19 May 2017 10:09:40 -0700 (PDT) From: Matthias Kaehlcke To: Paul Moore , Stephen Smalley , Eric Paris , James Morris , "Serge E . Hallyn" Cc: selinux@tycho.nsa.gov, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, Matthias Kaehlcke Subject: [PATCH] selinux: Remove redundant check for unknown labeling behavior Date: Fri, 19 May 2017 10:09:32 -0700 Message-Id: <20170519170932.67192-1-mka@chromium.org> X-Mailer: git-send-email 2.13.0.303.g4ebf302169-goog Sender: owner-linux-security-module@vger.kernel.org Precedence: bulk List-ID: X-Virus-Scanned: ClamAV using ClamSMTP The check is already performed in ocontext_read() when the policy is loaded. Removing the array also fixes the following warning when building with clang: security/selinux/hooks.c:338:20: error: variable 'labeling_behaviors' is not needed and will not be emitted [-Werror,-Wunneeded-internal-declaration] Signed-off-by: Matthias Kaehlcke Acked-by: Stephen Smalley --- security/selinux/hooks.c | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index e67a526d1f30..2e0227b0304f 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c @@ -398,18 +398,6 @@ static void superblock_free_security(struct super_block *sb) kfree(sbsec); } -/* The file system's label must be initialized prior to use. */ - -static const char *labeling_behaviors[7] = { - "uses xattr", - "uses transition SIDs", - "uses task SIDs", - "uses genfs_contexts", - "not configured for labeling", - "uses mountpoint labeling", - "uses native labeling", -}; - static inline int inode_doinit(struct inode *inode) { return inode_doinit_with_dentry(inode, NULL); @@ -524,10 +512,6 @@ static int sb_finish_set_opts(struct super_block *sb) } } - if (sbsec->behavior > ARRAY_SIZE(labeling_behaviors)) - printk(KERN_ERR "SELinux: initialized (dev %s, type %s), unknown behavior\n", - sb->s_id, sb->s_type->name); - sbsec->flags |= SE_SBINITIALIZED; if (selinux_is_sblabel_mnt(sb)) sbsec->flags |= SBLABEL_MNT;