All of lore.kernel.org
 help / color / mirror / Atom feed
From: J Freyensee <why2jjj.linux@gmail.com>
To: Peter Enderborg <peter.enderborg@sony.com>,
	Paul Moore <paul@paul-moore.com>,
	Stephen Smalley <sds@tycho.nsa.gov>,
	Eric Paris <eparis@parisplace.org>,
	James Morris <james.l.morris@oracle.com>,
	Daniel Jurgens <danielj@mellanox.com>,
	Doug Ledford <dledford@redhat.com>,
	selinux@tycho.nsa.gov, linux-security-module@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	"Serge E . Hallyn" <serge@hallyn.com>,
	"Paul E . McKenney" <paulmck@linux.vnet.ibm.com>
Subject: Re: [PATCH V3 3/5 selinux-next] selinux: sidtab_clone switch to use rwlock.
Date: Wed, 30 May 2018 14:22:40 -0700	[thread overview]
Message-ID: <c41e327f-9bf8-a2f1-bf6f-326357d5ed8b@gmail.com> (raw)
In-Reply-To: <20180530141104.28569-4-peter.enderborg@sony.com>


>   
> +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

WARNING: multiple messages have this Message-ID (diff)
From: why2jjj.linux@gmail.com (J Freyensee)
To: linux-security-module@vger.kernel.org
Subject: [PATCH V3 3/5 selinux-next] selinux: sidtab_clone switch to use rwlock.
Date: Wed, 30 May 2018 14:22:40 -0700	[thread overview]
Message-ID: <c41e327f-9bf8-a2f1-bf6f-326357d5ed8b@gmail.com> (raw)
In-Reply-To: <20180530141104.28569-4-peter.enderborg@sony.com>


>   
> +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
--
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

  reply	other threads:[~2018-05-30 21:22 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-30 14:10 [PATCH V3 0/5] selinux:Significant reduce of preempt_disable holds Peter Enderborg
2018-05-30 14:10 ` Peter Enderborg
2018-05-30 14:11 ` [PATCH V3 1/5 selinux-next] selinux: Make allocation atomic in policydb objects functions Peter Enderborg
2018-05-30 14:11   ` Peter Enderborg
2018-05-30 14:11 ` [PATCH V3 2/5 selinux-next] selinux: Introduce selinux_ruleset struct Peter Enderborg
2018-05-30 14:11   ` Peter Enderborg
2018-05-30 21:15   ` J Freyensee
2018-05-30 21:15     ` J Freyensee
2018-06-01 13:48   ` kbuild test robot
2018-06-01 13:48     ` kbuild test robot
2018-06-01 13:56   ` kbuild test robot
2018-06-01 13:56     ` kbuild test robot
2018-05-30 14:11 ` [PATCH V3 3/5 selinux-next] selinux: sidtab_clone switch to use rwlock Peter Enderborg
2018-05-30 14:11   ` Peter Enderborg
2018-05-30 21:22   ` J Freyensee [this message]
2018-05-30 21:22     ` J Freyensee
2018-05-31  5:35     ` peter enderborg
2018-05-31  5:35       ` peter enderborg
2018-05-30 14:11 ` [PATCH V3 4/5 selinux-next] selinux: seqno separation Peter Enderborg
2018-05-30 14:11   ` Peter Enderborg
2018-05-30 14:11 ` [PATCH V3 5/5 selinux-next] selinux: Switch to rcu read locks for avc_compute Peter Enderborg
2018-05-30 14:11   ` Peter Enderborg
2018-05-30 20:34 ` [PATCH V3 0/5] selinux:Significant reduce of preempt_disable holds Stephen Smalley
2018-05-30 20:34   ` Stephen Smalley
2018-05-31  9:04   ` peter enderborg
2018-05-31  9:04     ` peter enderborg
2018-05-31 12:42     ` Stephen Smalley
2018-05-31 12:42       ` Stephen Smalley
2018-05-31 14:12       ` peter enderborg
2018-05-31 14:12         ` peter enderborg
2018-05-31 14:21         ` Stephen Smalley
2018-05-31 14:21           ` Stephen Smalley
2018-05-31 16:40           ` Stephen Smalley
2018-05-31 16:40             ` Stephen Smalley
2018-06-01 11:18       ` peter enderborg
2018-06-01 11:18         ` peter enderborg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c41e327f-9bf8-a2f1-bf6f-326357d5ed8b@gmail.com \
    --to=why2jjj.linux@gmail.com \
    --cc=danielj@mellanox.com \
    --cc=dledford@redhat.com \
    --cc=eparis@parisplace.org \
    --cc=james.l.morris@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=paul@paul-moore.com \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=peter.enderborg@sony.com \
    --cc=sds@tycho.nsa.gov \
    --cc=selinux@tycho.nsa.gov \
    --cc=serge@hallyn.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.