[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c41e327f-9bf8-a2f1-bf6f-326357d5ed8b@gmail.com>
Date: Wed, 30 May 2018 14:22:40 -0700
From: J Freyensee <why2jjj.linux@...il.com>
To: Peter Enderborg <peter.enderborg@...y.com>,
Paul Moore <paul@...l-moore.com>,
Stephen Smalley <sds@...ho.nsa.gov>,
Eric Paris <eparis@...isplace.org>,
James Morris <james.l.morris@...cle.com>,
Daniel Jurgens <danielj@...lanox.com>,
Doug Ledford <dledford@...hat.com>, selinux@...ho.nsa.gov,
linux-security-module@...r.kernel.org,
linux-kernel@...r.kernel.org,
"Serge E . Hallyn" <serge@...lyn.com>,
"Paul E . McKenney" <paulmck@...ux.vnet.ibm.com>
Subject: Re: [PATCH V3 3/5 selinux-next] selinux: sidtab_clone switch to use
rwlock.
>
> +int sidtab_clone(struct sidtab *s, struct sidtab *d)
> +{
> + int i, rc = 0;
If s or d are NULL (see if() below), why would we want rc, the return
value, to be 0? How about defaulting rc to an error value (-EINVAL)?
> + struct sidtab_node *cur;
> +
> + if (!s || !d)
> + goto errout;
> +
> + read_lock(&s->lock);
> + for (i = 0; i < SIDTAB_SIZE; i++) {
> + cur = s->htable[i];
> + while (cur) {
> + if (cur->sid > SECINITSID_NUM)
> + rc = sidtab_insert(d, cur->sid, &cur->context);
> + if (rc)
> + goto out;
> + cur = cur->next;
> + }
> + }
> +out:
> + read_unlock(&s->lock);
> +errout:
> + return rc;
> +}
>
Thanks,
Jay
Powered by blists - more mailing lists