From patchwork Sun Jan 15 15:12:03 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: 9517479 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 989DC607D4 for ; Sun, 15 Jan 2017 15:12:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8AC632845B for ; Sun, 15 Jan 2017 15:12:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7C00728495; Sun, 15 Jan 2017 15:12:32 +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 368EA2845B for ; Sun, 15 Jan 2017 15:12:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751166AbdAOPMT (ORCPT ); Sun, 15 Jan 2017 10:12:19 -0500 Received: from mout.web.de ([212.227.15.3]:51016 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751114AbdAOPMS (ORCPT ); Sun, 15 Jan 2017 10:12:18 -0500 Received: from [192.168.1.2] ([78.49.147.199]) by smtp.web.de (mrweb002 [213.165.67.108]) with ESMTPSA (Nemesis) id 0M3Bqx-1ckajx3dgN-00swqm; Sun, 15 Jan 2017 16:12:07 +0100 Subject: [PATCH 12/46] selinux: Move assignments for two pointers in genfs_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: <05e70901-776f-8f3c-f0f3-014a42712dc6@users.sourceforge.net> Date: Sun, 15 Jan 2017 16:12:03 +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:UbljtYLcc/gOsAZ5jkCDQ7TfYq3yoDvdi/v9wbzJxLFIi+KubFL NcFP2Kf2lKOHnxu1oRUPuEH658mBWa2xizQJu3ZZHtr97AdCBHoCLJTcUbiEvMyaY4BytVi q8wBVLJlY75VeaNpr6Du4N4X0p/+rFZEPkpMaf1d7a0R5/Q9AUp0SWr8EMxXIY6qzrProie 0spz81RA8lz9qay5+0GqA== X-UI-Out-Filterresults: notjunk:1; V01:K0:JlnIGcImfxI=:lXAWug2goBILujgaEPDAzj /tnJjaq8/7AYnzhkhgDYWhdFl2ucJRk0U8kXGynyGofYsJ3stKiqVklbmy/FYfOdbEsEanh5H O9LlGRRBpCBafNUECl1M7wZL4H+BluSYt8lLr2695mkfmK0EHh1AzUrtNAl0tkLWxI2kAeUa8 qFJXdeu9FSMjOvb+9ZW5R0FJT116fU/Xpu7uY19ty6kUYLj/8xDQ0Z10yK7pNiY5pHVpfoXEN 3Ci+MQZu87RtDr2niwzgJh/lu2w/4W1AmvrxPCpxIcF5DaqzZkgyTL4O3s1eSzCxOyDhsCI2H z5CLH32m4W9r984AbrgpoeLmdqHN2qkQOmJJTBgZiGxq4StbMjicNXu+flbjzf2RAoN6J21Qu Wx8MOg/rBUHGtDNSUSp2SZxado0J91AQ0TwSEtaZqjjIQauCSxWHInYs03MzCgEYIDEmwEWJF WlkGV5Ow+CpLOow3ACTaNWQ4vltZuAXsnOQDp8tcxsNtMwkxgpzUC334zV1zA9R8cuEs+Oau2 TEu2mWsvSx5hZarPwaYKulzX9bQ10cik/IG+Tb8fak6ub/IA0wAceaRMW6b5ZzREf9ptqQZRE HNqjIUoiAM/2TSeWemQdxm3lLnVvKGO9FZpzLM6swavIQPUNDyla9n6fBAX+ve7hg/cpdf26Y V/o3wPGDOg1dO+ZcGWOd+J0O0P1nvkn70GHzUTa19hDqQqP+dkpSKQBCWuV2XwPkbMFKtxB4w fxF/5k1mYjs4h+kdRBlwWt8R8rZuWnX9+Rxv7By/FSB47EXVPjViiPS0J1FxddzhtpinCAtPS FWhD280 Sender: owner-linux-security-module@vger.kernel.org Precedence: bulk List-ID: X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Sat, 14 Jan 2017 16:56:51 +0100 Move the assignment for the local variables "newc" and "newgenfs" behind a call of the function "next_entry" at the beginning so that they will only be set after a successful call. Signed-off-by: Markus Elfring --- security/selinux/ss/policydb.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/security/selinux/ss/policydb.c b/security/selinux/ss/policydb.c index 754f829d2027..7544e374dec9 100644 --- a/security/selinux/ss/policydb.c +++ b/security/selinux/ss/policydb.c @@ -1997,14 +1997,14 @@ static int genfs_read(struct policydb *p, void *fp) int i, j, rc; u32 nel, nel2, len, len2; __le32 buf[1]; - struct ocontext *l, *c; - struct ocontext *newc = NULL; - struct genfs *genfs_p, *genfs; - struct genfs *newgenfs = NULL; + struct ocontext *l, *c, *newc; + struct genfs *genfs_p, *genfs, *newgenfs; rc = next_entry(buf, fp, sizeof(u32)); if (rc) return rc; + newc = NULL; + newgenfs = NULL; nel = le32_to_cpu(buf[0]); for (i = 0; i < nel; i++) {