From patchwork Sun Jan 15 15:33:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 9517561 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 B58DA601DA for ; Sun, 15 Jan 2017 15:33:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A64E427E3E for ; Sun, 15 Jan 2017 15:33:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9642B2839B; Sun, 15 Jan 2017 15:33:23 +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.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI 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 3975727E3E for ; Sun, 15 Jan 2017 15:33:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751227AbdAOPdV (ORCPT ); Sun, 15 Jan 2017 10:33:21 -0500 Received: from mout.web.de ([212.227.15.4]:52511 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751129AbdAOPdU (ORCPT ); Sun, 15 Jan 2017 10:33:20 -0500 Received: from [192.168.1.2] ([78.49.147.199]) by smtp.web.de (mrweb003 [213.165.67.108]) with ESMTPSA (Nemesis) id 0Lba5z-1cq43r2ewF-00lE4l; Sun, 15 Jan 2017 16:33:08 +0100 Subject: [PATCH 33/46] selinux: Move an assignment for the variable "rc" in class_read() To: linux-security-module@vger.kernel.org, selinux@tycho.nsa.gov, Eric Paris , James Morris , Paul Moore , "Serge E. Hallyn" , Stephen Smalley , William Roberts References: Cc: LKML , kernel-janitors@vger.kernel.org From: SF Markus Elfring Message-ID: Date: Sun, 15 Jan 2017 16:33:06 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0 MIME-Version: 1.0 In-Reply-To: X-Provags-ID: V03:K0:CcqB2EfO/jksn9T0fXcFvbk/57pcrch2H/TNxam4tsXSXffXJx8 efsuz9oQ/GjUiOn2k+iaJEYKQXh6weIQ0mXQKXlaOz/T4qXlU39C07Vn7RjdrSiruSUKEUM 1t0LDBqclRJOuPM6wwGLRh5wJuJXrnJNYsN9dPuiLjObHYUiTWrm8JR/Tk5kLbyvR4WqtBK H0kwAzfHTF86jh1RechHg== X-UI-Out-Filterresults: notjunk:1; V01:K0:YJdSJvg5B2Y=:y4s3OxzQmCf2ljQVLhwnHd U2mRcN+T5ihw92G3+tGq8OBBu/ecZuSGQHiihURvEGGsKaL91eKsWYY8ZW/R3cnv0+f4XRYGY 3XCKZ4e07FIWU0uevvFX/P0h+FsQ32oLnBaVIAWwjEPqHL1QFiNiGCaUTzVji1CvOAqHH/+bm wR158LIxyCPvjCzgmlafFogfriKKL2PQKTdBhRubc5X2EByz7shJ4QcNcpwHtB/HPpvs4ZmFT cGTKyXZ2cXw6ehUrrGJ49bTI/LUIS4vF8Q4xbE7qlJ+51a0gcxz2iTU7KPkDXSEIrocLAINLn tg8aMbUBjDIo+QZEQGnnX3UmAvR9tig9u6CDuRlOT1lq71tQ7ciz0Ufh1hoCzyEJqS5o2EEhW 1/J0bIiJ0vwQ5uWGroUyE/WF4tTX6/IL6z2uZxjKM4WGXW8XJ2zwAI0XEMeRmTPog3eJ92wjk bOTon06cxe99GLVoTey72rCQe4zbHa5gAUWtiU03Ht/lsA1GIYS8nPUB0MOaNEIwLIC29AmJa kVn9w2QX0ajdLmEi6/fmpt/5J+Uvoeu5pzoRkQ6ZKzF1uYtB1MTk7nmH/EsCxVL/BiKJPXkLW mw1n6Idtbws4iU4mbH01VCW+xuCm9UvY/IeTCTWx0ngp9ViR3bkatNJZgMRuwi3hlFGFeraVr EeWhP0TV7Vtq2Ul40KM9yDnbjW0CjIvwlaBMBli4WO0vBjm5KodkZQOeICdb8c4Qjep698Orx 1KHJEurvnrTWTR4AAfB023KUmg91+HQUz5vD8u8K5jsscRCdUBjzyv/ZUbNn/NfrIvog9B30y skqW4hb Sender: owner-linux-security-module@vger.kernel.org Precedence: bulk List-ID: X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Sun, 15 Jan 2017 11:10:39 +0100 A local variable was set to an error code in one case before a concrete error situation was detected. Thus move the corresponding assignment into an if branch to indicate a software failure there. Signed-off-by: Markus Elfring --- security/selinux/ss/policydb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/security/selinux/ss/policydb.c b/security/selinux/ss/policydb.c index 3af2b0849495..9035e5329ceb 100644 --- a/security/selinux/ss/policydb.c +++ b/security/selinux/ss/policydb.c @@ -1345,10 +1345,10 @@ static int class_read(struct policydb *p, struct hashtab *h, void *fp) if (rc) goto bad; - rc = -EINVAL; cladatum->comdatum = hashtab_search(p->p_commons.table, cladatum->comkey); if (!cladatum->comdatum) { printk(KERN_ERR "SELinux: unknown common %s\n", cladatum->comkey); + rc = -EINVAL; goto bad; } }