From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752476AbdCWWSx (ORCPT ); Thu, 23 Mar 2017 18:18:53 -0400 Received: from mail-vk0-f66.google.com ([209.85.213.66]:33222 "EHLO mail-vk0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751306AbdCWWSu (ORCPT ); Thu, 23 Mar 2017 18:18:50 -0400 MIME-Version: 1.0 X-Originating-IP: [108.49.102.27] In-Reply-To: <668d71a5-d55c-449e-9de8-b5d70d7e11c9@users.sourceforge.net> References: <668d71a5-d55c-449e-9de8-b5d70d7e11c9@users.sourceforge.net> From: Paul Moore Date: Thu, 23 Mar 2017 18:18:48 -0400 Message-ID: Subject: Re: [PATCH 23/46] selinux: Move an assignment for a pointer in range_read() 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:23 AM, SF Markus Elfring wrote: > From: Markus Elfring > Date: Sat, 14 Jan 2017 21:00:45 +0100 > > Move the assignment for the local variable "r" behind a call of the > function "next_entry" at the beginning so that it will only be set > after a successful call. > > Signed-off-by: Markus Elfring > --- > security/selinux/ss/policydb.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) See previous comments. > diff --git a/security/selinux/ss/policydb.c b/security/selinux/ss/policydb.c > index 6121a26ada64..5101592ae172 100644 > --- a/security/selinux/ss/policydb.c > +++ b/security/selinux/ss/policydb.c > @@ -1840,7 +1840,7 @@ u32 string_to_av_perm(struct policydb *p, u16 tclass, const char *name) > static int range_read(struct policydb *p, void *fp) > { > struct range_trans *rt; > - struct mls_range *r = NULL; > + struct mls_range *r; > int i, rc; > __le32 buf[2]; > u32 nel; > @@ -1852,6 +1852,7 @@ static int range_read(struct policydb *p, void *fp) > if (rc) > return rc; > > + r = NULL; > nel = le32_to_cpu(buf[0]); > for (i = 0; i < nel; i++) { > rt = kzalloc(sizeof(*rt), GFP_KERNEL); > -- > 2.11.0 > -- paul moore www.paul-moore.com From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paul Moore Date: Thu, 23 Mar 2017 22:18:48 +0000 Subject: Re: [PATCH 23/46] selinux: Move an assignment for a pointer in range_read() Message-Id: List-Id: References: <668d71a5-d55c-449e-9de8-b5d70d7e11c9@users.sourceforge.net> In-Reply-To: <668d71a5-d55c-449e-9de8-b5d70d7e11c9@users.sourceforge.net> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: linux-security-module@vger.kernel.org On Sun, Jan 15, 2017 at 10:23 AM, SF Markus Elfring wrote: > From: Markus Elfring > Date: Sat, 14 Jan 2017 21:00:45 +0100 > > Move the assignment for the local variable "r" behind a call of the > function "next_entry" at the beginning so that it will only be set > after a successful call. > > Signed-off-by: Markus Elfring > --- > security/selinux/ss/policydb.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) See previous comments. > diff --git a/security/selinux/ss/policydb.c b/security/selinux/ss/policydb.c > index 6121a26ada64..5101592ae172 100644 > --- a/security/selinux/ss/policydb.c > +++ b/security/selinux/ss/policydb.c > @@ -1840,7 +1840,7 @@ u32 string_to_av_perm(struct policydb *p, u16 tclass, const char *name) > static int range_read(struct policydb *p, void *fp) > { > struct range_trans *rt; > - struct mls_range *r = NULL; > + struct mls_range *r; > int i, rc; > __le32 buf[2]; > u32 nel; > @@ -1852,6 +1852,7 @@ static int range_read(struct policydb *p, void *fp) > if (rc) > return rc; > > + r = NULL; > nel = le32_to_cpu(buf[0]); > for (i = 0; i < nel; i++) { > rt = kzalloc(sizeof(*rt), GFP_KERNEL); > -- > 2.11.0 > -- paul moore www.paul-moore.com From mboxrd@z Thu Jan 1 00:00:00 1970 From: paul@paul-moore.com (Paul Moore) Date: Thu, 23 Mar 2017 18:18:48 -0400 Subject: [PATCH 23/46] selinux: Move an assignment for a pointer in range_read() In-Reply-To: <668d71a5-d55c-449e-9de8-b5d70d7e11c9@users.sourceforge.net> References: <668d71a5-d55c-449e-9de8-b5d70d7e11c9@users.sourceforge.net> Message-ID: To: linux-security-module@vger.kernel.org List-Id: linux-security-module.vger.kernel.org On Sun, Jan 15, 2017 at 10:23 AM, SF Markus Elfring wrote: > From: Markus Elfring > Date: Sat, 14 Jan 2017 21:00:45 +0100 > > Move the assignment for the local variable "r" behind a call of the > function "next_entry" at the beginning so that it will only be set > after a successful call. > > Signed-off-by: Markus Elfring > --- > security/selinux/ss/policydb.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) See previous comments. > diff --git a/security/selinux/ss/policydb.c b/security/selinux/ss/policydb.c > index 6121a26ada64..5101592ae172 100644 > --- a/security/selinux/ss/policydb.c > +++ b/security/selinux/ss/policydb.c > @@ -1840,7 +1840,7 @@ u32 string_to_av_perm(struct policydb *p, u16 tclass, const char *name) > static int range_read(struct policydb *p, void *fp) > { > struct range_trans *rt; > - struct mls_range *r = NULL; > + struct mls_range *r; > int i, rc; > __le32 buf[2]; > u32 nel; > @@ -1852,6 +1852,7 @@ static int range_read(struct policydb *p, void *fp) > if (rc) > return rc; > > + r = NULL; > nel = le32_to_cpu(buf[0]); > for (i = 0; i < nel; i++) { > rt = kzalloc(sizeof(*rt), GFP_KERNEL); > -- > 2.11.0 > -- paul moore www.paul-moore.com -- To unsubscribe from this list: send the line "unsubscribe linux-security-module" in the body of a message to majordomo at vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html