From patchwork Sun Jan 15 15:36:01 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: 9517575 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 DEAF16188A for ; Sun, 15 Jan 2017 15:36:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9BD7627E3E for ; Sun, 15 Jan 2017 15:36:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 90ABC28387; Sun, 15 Jan 2017 15:36:30 +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 450DB27E3E for ; Sun, 15 Jan 2017 15:36:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751276AbdAOPgQ (ORCPT ); Sun, 15 Jan 2017 10:36:16 -0500 Received: from mout.web.de ([212.227.15.3]:58637 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751098AbdAOPgP (ORCPT ); Sun, 15 Jan 2017 10:36:15 -0500 Received: from [192.168.1.2] ([78.49.147.199]) by smtp.web.de (mrweb001 [213.165.67.108]) with ESMTPSA (Nemesis) id 0MGzFy-1cF3Ka3kdW-00DmfQ; Sun, 15 Jan 2017 16:36:03 +0100 Subject: [PATCH 36/46] selinux: Move an assignment for the variable "rc" in mls_read_range_helper() 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: <02c3392e-3507-4d91-a8c0-6d933a034058@users.sourceforge.net> Date: Sun, 15 Jan 2017 16:36:01 +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:pi1ovlpBo7KyLjtXbeTVRFXOOGF9kfXieI6i5Wbb3EtsN41EQZw 4bIur+GqF2IAhJ7G9P6NWUQogvPAIkkmg7dfTnVJV3bMjNivjxBHzrmMQUuFUAZ8LUpwXGb +qAiHNHQ4ertbqDm1xN99CGgPVD+bvNnCNoC73dKOLmds+KuW93X+f45mlLbeLJQqpbW8f8 Qqcb7NhGlW9I4B28LLknQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:Dh0AyIAYpBI=:yTBHWkAgCjPi7VvAp9sQyK VSSuplwwxW15qu22llclOpoXvzUELNDd32URXvnATgf1iCoVTaQHiclrWThDN3+hxV4jZ3urP CpFdBfRy4fHpoZ1oGOj4tRKLXSKgEcy7esHHH4fBGTjKtJ/ouhg+rX0ZwAjoY017wHLgT/UYN w6mBr3C91rdbJh92boIrpO+7jt5BsP5SNQEX5jLP/5QUohYrJnJ7Aqo+rZ4/jwaZ4Y7fhtEPR 3HcMGq1BJbdJgsKGNo4gIYrbVH2AJD3x2tm+D7mYPMHPPollIrjDvUFUBSq9HhqOi9jwrRz3M aXVQShNLx3C0L//1gJmeO91bF6/tYVdDDAhNIjUzuKovdoOg029BlAasClkdkYQAyMSwlsGHM Dey+UijH3GCiaHpzHcxSw+yQ2uJkcTjigwf1DJ/iOLmHhdv/aQgTUozkcxW6icVRNFuPfVtjw QBTSC3D06oM8Tdd6UmwNWQ5G0m47kbbd/qY/BXPTlV6alOC4VhjU8ePJBPF1+SLx6Avx6g6q6 lKy2hkyqlJuo9YxEcybs6Lwmrf1synq0Yx16tmu0PgDPwr2ta6vFcjC2CGQoymSA/H0Ue3Jds YiuHLClnr72Mj0wdib4awRSwT6vqqE6EuEAHPFVoEL1tSuFx8K3iJwqzN8qJXoEQqHVrcwUNV y96mbWreqGXvF3jkOtBNPkHuUMP5uhY0wMcj50vTYBlc8spI5rI7PM7PASv08EmK8BC2hUSeR 020BKaFetYI9HDuVnIeRYilTi3/9pVjpQz9JAzSfyWMgo2+lGKobneEcLiJ3QB5MaUmyoLnKP wb4CsnO 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:22:23 +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 9b595f2e0d9f..7cf635c650dc 100644 --- a/security/selinux/ss/policydb.c +++ b/security/selinux/ss/policydb.c @@ -996,10 +996,10 @@ static int mls_read_range_helper(struct mls_range *r, void *fp) if (rc) goto out; - rc = -EINVAL; items = le32_to_cpu(buf[0]); if (items > ARRAY_SIZE(buf)) { printk(KERN_ERR "SELinux: mls: range overflow\n"); + rc = -EINVAL; goto out; }