From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751975AbdCWWKl (ORCPT ); Thu, 23 Mar 2017 18:10:41 -0400 Received: from mail-vk0-f66.google.com ([209.85.213.66]:35811 "EHLO mail-vk0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751390AbdCWWKj (ORCPT ); Thu, 23 Mar 2017 18:10:39 -0400 MIME-Version: 1.0 X-Originating-IP: [108.49.102.27] In-Reply-To: <358b5114-aeb3-d5fa-bcf9-239bd383d3b5@users.sourceforge.net> References: <358b5114-aeb3-d5fa-bcf9-239bd383d3b5@users.sourceforge.net> From: Paul Moore Date: Thu, 23 Mar 2017 18:10:37 -0400 Message-ID: Subject: Re: [PATCH 18/46] selinux: One function call less in filename_trans_read() after error detection To: SF Markus Elfring Cc: linux-security-module@vger.kernel.org, selinux@tycho.nsa.gov, Eric Paris , James Morris , "Serge E. Hallyn" , Stephen Smalley , William Roberts , LKML , kernel-janitors@vger.kernel.org Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Jan 15, 2017 at 10:18 AM, SF Markus Elfring wrote: > 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(-) It doesn't seem like this is worth adding another jump label. > 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 > -- paul moore www.paul-moore.com