From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751318AbdAOPVd (ORCPT ); Sun, 15 Jan 2017 10:21:33 -0500 Received: from mout.web.de ([212.227.15.14]:51563 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751111AbdAOPVa (ORCPT ); Sun, 15 Jan 2017 10:21:30 -0500 Subject: [PATCH 21/46] selinux: Two function calls less in range_read() after error detection 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: <1e37fe86-2e83-c1f0-f43b-69ed2fb5c7aa@users.sourceforge.net> Date: Sun, 15 Jan 2017 16:21:15 +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: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:1PirTEJ6HoTESOgb9ym5dcA2aegrEjCt4TyM965/ux8Nu+6ykCz vfva+HidpDcvGKVblmr95S42QEKn95Yq+P5wrK1FM4QGfyBnKOpQymFOu8Ea8uWucCWo5d/ l9xsI1O9Tzuu/KsvamWTb8h0jmAOlvRMrE2otay8EKKl87jBqyk/+bn93Vq/Xw8SdKQNe/5 HtgBR0fGY79zywpLhJc3w== X-UI-Out-Filterresults: notjunk:1;V01:K0:XSD5YwtEbUk=:tdIcc4cZxrSloZKuB6099b OCnYuneIsy/jlNzDBcHtJQPlk1gx3EZQeDS+zuQO5NQu1rmeFMM5cNQ5tYS0plviZLfN1GmbB eJHznkv2x9l2NdeqdI5z0371A+9jCOF+rep8Dmu/5VdyMjSj8OqVdCnWo5+4nThlK7BEwzOjA s14YPvi8WeLpRaB78sAnvap/gGQWsuP7oXjd/Dqoo0k3wpOWLGG09Iml5Mk5GgM0Nq10M52Zn y6wbQ7mscs5ZbwfQWqZ/Nrb+yskQCF8nLlTM/AEbNYBXdHjWBLHea3bHrDJqbAV5JoowNWLdK 5ad05P35Lwu0fMr+eyY9OKh/EMh3P+jEzPVjzu/LOSGbjQx6LZc1xszMtu4iLHsjYDCobQ6gZ gRUx+KUAFnlHn4gYjHfwJJdPulfk8QDwYZ61H+JMVW64pX58kn1q5kQs1uiz+jMW0RQmq1F+3 6qOC8Q3Yz+gAZuyAYQdDA/o/nnxxMmf2yndmdI1oDDEth8cDiUS7cAZavSxoF4+acXaEyfNCe oLKHw1KSDKGkyqMFIgyJY/W2IilitYBtIUd8V41Smg9B04K4oG1r/oY4ofzsC7osTJnYwx81N fy5yuXl+VIBNBz12fz9+eifXFdwFAPBRIu6ONXJqJceeowadAj/8NlMZnUqTgj2rHebbQxVE/ 3pEei+MZYysbJGsvm64BSSd7odnj5Lxknf0Hj4lTP8LtgqhajWYEVDIZLWvNjmlljmXXS8TtC YEfTbbDuCTSRHhGP2Hq/YBZRVWkgSNtV3DDpyHJFg4B2P0S8Ue0ELT/gsQ8aPnNtvcNKp7F8G gCrwn/5 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Markus Elfring Date: Sat, 14 Jan 2017 20:20:15 +0100 Adjust a jump target to avoid two calls of the function "kfree" at the end after a memory allocation failed for the local variable "rt". Signed-off-by: Markus Elfring --- security/selinux/ss/policydb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/security/selinux/ss/policydb.c b/security/selinux/ss/policydb.c index 4cd96ce51322..0d2f64558c0a 100644 --- a/security/selinux/ss/policydb.c +++ b/security/selinux/ss/policydb.c @@ -1857,7 +1857,7 @@ static int range_read(struct policydb *p, void *fp) rt = kzalloc(sizeof(*rt), GFP_KERNEL); if (!rt) { rc = -ENOMEM; - goto out; + goto exit; } rc = next_entry(buf, fp, (sizeof(u32) * 2)); @@ -1909,6 +1909,7 @@ static int range_read(struct policydb *p, void *fp) out: kfree(rt); kfree(r); +exit: return rc; } -- 2.11.0 From mboxrd@z Thu Jan 1 00:00:00 1970 From: SF Markus Elfring Date: Sun, 15 Jan 2017 15:21:15 +0000 Subject: [PATCH 21/46] selinux: Two function calls less in range_read() after error detection Message-Id: <1e37fe86-2e83-c1f0-f43b-69ed2fb5c7aa@users.sourceforge.net> List-Id: References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: linux-security-module@vger.kernel.org, selinux@tycho.nsa.gov, Eric Paris , James Morris , Paul Moore , "Serge E. Hallyn" , Stephen Smalley , William Roberts Cc: LKML , kernel-janitors@vger.kernel.org From: Markus Elfring Date: Sat, 14 Jan 2017 20:20:15 +0100 Adjust a jump target to avoid two calls of the function "kfree" at the end after a memory allocation failed for the local variable "rt". Signed-off-by: Markus Elfring --- security/selinux/ss/policydb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/security/selinux/ss/policydb.c b/security/selinux/ss/policydb.c index 4cd96ce51322..0d2f64558c0a 100644 --- a/security/selinux/ss/policydb.c +++ b/security/selinux/ss/policydb.c @@ -1857,7 +1857,7 @@ static int range_read(struct policydb *p, void *fp) rt = kzalloc(sizeof(*rt), GFP_KERNEL); if (!rt) { rc = -ENOMEM; - goto out; + goto exit; } rc = next_entry(buf, fp, (sizeof(u32) * 2)); @@ -1909,6 +1909,7 @@ static int range_read(struct policydb *p, void *fp) out: kfree(rt); kfree(r); +exit: return rc; } -- 2.11.0