Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751367AbdHMQW2 (ORCPT ); Sun, 13 Aug 2017 12:22:28 -0400 Received: from h2.hallyn.com ([78.46.35.8]:51102 "EHLO h2.hallyn.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750996AbdHMQW0 (ORCPT ); Sun, 13 Aug 2017 12:22:26 -0400 Date: Sun, 13 Aug 2017 11:22:33 -0500 From: "Serge E. Hallyn" To: SF Markus Elfring Cc: linux-security-module@vger.kernel.org, selinux@tycho.nsa.gov, Alexey Dobriyan , Daniel Jurgens , Eric Paris , James Morris , Junil Lee , Paul Moore , "Serge E. Hallyn" , Stephen Smalley , William Roberts , LKML , kernel-janitors@vger.kernel.org Subject: Re: [PATCH 1/4] selinux: Delete eight unnecessary variable assignments Message-ID: <20170813162233.GB4515@mail.hallyn.com> References: <05edc763-dddd-fe48-b98c-21e4ad5463a3@users.sourceforge.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <05edc763-dddd-fe48-b98c-21e4ad5463a3@users.sourceforge.net> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3526 Lines: 132 Quoting SF Markus Elfring (elfring@users.sourceforge.net): > From: Markus Elfring > Date: Sun, 13 Aug 2017 14:17:48 +0200 > > One local variable was reset to zero at the end of these functions. > This value will also be set by a previous call of a function if it was > executed successfully. Thus omit an extra assignment there. > > Signed-off-by: Markus Elfring Acked-by: Serge Hallyn > --- > security/selinux/selinuxfs.c | 1 - > security/selinux/ss/avtab.c | 2 -- > security/selinux/ss/ebitmap.c | 4 +--- > security/selinux/ss/policydb.c | 10 ++-------- > 4 files changed, 3 insertions(+), 14 deletions(-) > > diff --git a/security/selinux/selinuxfs.c b/security/selinux/selinuxfs.c > index 00eed842c491..7565c312a198 100644 > --- a/security/selinux/selinuxfs.c > +++ b/security/selinux/selinuxfs.c > @@ -1724,7 +1724,6 @@ static int sel_make_classes(void) > if (rc) > goto out; > } > - rc = 0; > out: > for (i = 0; i < nclasses; i++) > kfree(classes[i]); > diff --git a/security/selinux/ss/avtab.c b/security/selinux/ss/avtab.c > index 3628d3a868b6..a8218905e286 100644 > --- a/security/selinux/ss/avtab.c > +++ b/security/selinux/ss/avtab.c > @@ -587,8 +587,6 @@ int avtab_read(struct avtab *a, void *fp, struct policydb *pol) > goto bad; > } > } > - > - rc = 0; > out: > return rc; > > diff --git a/security/selinux/ss/ebitmap.c b/security/selinux/ss/ebitmap.c > index ad38299164c3..ccf372db689c 100644 > --- a/security/selinux/ss/ebitmap.c > +++ b/security/selinux/ss/ebitmap.c > @@ -373,7 +373,7 @@ int ebitmap_read(struct ebitmap *e, void *fp) > > if (!e->highbit) { > e->node = NULL; > - goto ok; > + goto out; > } > > if (e->highbit && !count) > @@ -436,8 +436,6 @@ int ebitmap_read(struct ebitmap *e, void *fp) > map = EBITMAP_SHIFT_UNIT_SIZE(map); > } > } > -ok: > - rc = 0; > out: > return rc; > bad: > diff --git a/security/selinux/ss/policydb.c b/security/selinux/ss/policydb.c > index aa6500abb178..a2356fc263c6 100644 > --- a/security/selinux/ss/policydb.c > +++ b/security/selinux/ss/policydb.c > @@ -599,7 +599,6 @@ static int policydb_index(struct policydb *p) > if (rc) > goto out; > } > - rc = 0; > out: > return rc; > } > @@ -903,10 +902,10 @@ int policydb_load_isids(struct policydb *p, struct sidtab *s) > > head = p->ocontexts[OCON_ISID]; > for (c = head; c; c = c->next) { > - rc = -EINVAL; > if (!c->context[0].user) { > printk(KERN_ERR "SELinux: SID %s was never defined.\n", > c->u.name); > + rc = -EINVAL; > goto out; > } > > @@ -917,7 +916,6 @@ int policydb_load_isids(struct policydb *p, struct sidtab *s) > goto out; > } > } > - rc = 0; > out: > return rc; > } > @@ -1074,13 +1072,12 @@ static int context_read_and_validate(struct context *c, > } > } > > - rc = -EINVAL; > if (!policydb_context_isvalid(p, c)) { > printk(KERN_ERR "SELinux: invalid security context\n"); > context_destroy(c); > + rc = -EINVAL; > goto out; > } > - rc = 0; > out: > return rc; > } > @@ -1900,7 +1897,6 @@ static int range_read(struct policydb *p, void *fp) > r = NULL; > } > hash_eval(p->range_tr, "rangetr"); > - rc = 0; > out: > kfree(rt); > kfree(r); > @@ -2550,8 +2546,6 @@ int policydb_read(struct policydb *p, void *fp) > rc = policydb_bounds_sanity_check(p); > if (rc) > goto bad; > - > - rc = 0; > out: > return rc; > bad: > -- > 2.14.0