From patchwork Sun Jan 15 15:37:04 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: 9517577 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 8DBE460938 for ; Sun, 15 Jan 2017 15:37:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7777E28387 for ; Sun, 15 Jan 2017 15:37:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 68E95283E8; Sun, 15 Jan 2017 15:37:28 +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 1D7FD28387 for ; Sun, 15 Jan 2017 15:37:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751131AbdAOPh1 (ORCPT ); Sun, 15 Jan 2017 10:37:27 -0500 Received: from mout.web.de ([212.227.15.4]:61002 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751098AbdAOPh0 (ORCPT ); Sun, 15 Jan 2017 10:37:26 -0500 Received: from [192.168.1.2] ([78.49.147.199]) by smtp.web.de (mrweb004 [213.165.67.108]) with ESMTPSA (Nemesis) id 0LxaUl-1cU7IK2gYd-017Gv7; Sun, 15 Jan 2017 16:37:11 +0100 Subject: [PATCH 37/46] selinux: Move an assignment for the variable "rc" in policydb_load_isids() 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: <9202247d-8f44-8839-cf78-453b6e3b7d1e@users.sourceforge.net> Date: Sun, 15 Jan 2017 16:37:04 +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:ZL+VuLnij8CtP7h6vXkbusnIL5Q2tDLyy6sUJBouNnvSW8xgMeS b1Xkcc9fhLpjtjrNV5Vayr/tk6/QGGY2YGoHP0lVx/Uyf5mNEHu2JOcbKAb4mARPKJoiZpF 9qBKTn1Y7kNo8+4Eq8rTEFL1bSyIPCGBywundmOAQ7Ou94DPy0Z1Pp0f1TZgPz883OXdHal 0o9RaOtjjVBrZOjuMG1dA== X-UI-Out-Filterresults: notjunk:1; V01:K0:biQ0kiANks4=:AtLB/4xGvNhv9AvlelGLdn 8qEywe2qd4bnuov9UB7Bh0iPBhloiTzFP+cGD+VQYcP0rQH3IFbAw/4IOyqDkYWRoPHxrbCFl dgwz5vYl9IFuCVC+MaS/i1c2ebRppEiZd07I7laRwvQBqm5tRmm13OfBv5IqAg15FxzWML+EQ FGjCHpauTe76FPGdAXhOu6HP5yi1aAXjyKhHZw4ZQir3E+iLyNEvrhc19AkXvXMDHe0tsFLLt qQ4eNtnmPW/UmdOwOP4mWphJYw+5/AW61igbfxvqvDdm33ypzbe/FWa+b8TMJ9QLhLHIR+p+9 6vWkTl22vQMiDCq+RVUzdhX1xn6l/ELxRKWMDl9xjAj61fN/fC58e5k6JeV3K048N6otucONV e30XLTBvl6U6c6A6FyNOShLhqf9LtYbKieGPxqRobCibmTh+rlmiuJYNSFUMbEdBeMwlPOdR8 mBtm1psUs2rpXvuC04VoKRLulDXOWG4biXIZ6+AHJlv95jx2sTnUQVf5PtHTAdc5sY8DjZplw p+wuKXK9YIRdDt3/pWnV307yPJ4EKTgYV/iRFgRcyOKSHH5bVSfEfkeWlt9gkM6iLFU3fbSoJ j5oP0I7pm0hcKreSUK4JbpUymRqnqmQg+/YM0xWQUXxrewsVzmQsiGtSLnIHfNDbesGTxlNGx GYncil3ki8m+3i0zv0RpyYrQOPWxjc7N+BVBcUNiNYD4MnnvJ1myjszpe4/kJM8WZp1n9mqNL jHtWFNbKe9i59P6m4RO+vNUUV0PWxbv4UMJzb55TtLTJDyLMAI7OeUSNrcuZrEqUVFEsiYnTM QHOjnuE 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:24:51 +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 7cf635c650dc..faa6ecc2450d 100644 --- a/security/selinux/ss/policydb.c +++ b/security/selinux/ss/policydb.c @@ -897,10 +897,10 @@ int policydb_load_isids(struct policydb *p, struct sidtab *s) head = p->ocontexts[OCON_ISID]; for (c = head; c; c = c->next) { - rc = -EINVAL; if (!c->context[0].user) { printk(KERN_ERR "SELinux: SID %s was never defined.\n", c->u.name); + rc = -EINVAL; goto out; }