From mboxrd@z Thu Jan 1 00:00:00 1970 From: SF Markus Elfring Date: Sun, 15 Jan 2017 15:18:06 +0000 Subject: [PATCH 18/46] selinux: One function call less in filename_trans_read() after error detection Message-Id: <358b5114-aeb3-d5fa-bcf9-239bd383d3b5@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 19:19:42 +0100 Adjust a jump target to avoid a function call at the end after a memory allocation failed for the local variable "ft". 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 2be5b18eb149..5f122e846332 100644 --- a/security/selinux/ss/policydb.c +++ b/security/selinux/ss/policydb.c @@ -1932,7 +1932,7 @@ static int filename_trans_read(struct policydb *p, void *fp) ft = kzalloc(sizeof(*ft), GFP_KERNEL); if (!ft) { rc = -ENOMEM; - goto out; + goto free_name; } otype = kmalloc(sizeof(*otype), GFP_KERNEL); @@ -1986,6 +1986,7 @@ static int filename_trans_read(struct policydb *p, void *fp) return 0; out: kfree(ft); +free_name: kfree(name); kfree(otype); -- 2.11.0