SELinux Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] selinux: remove some no-op BUG_ONs
@ 2019-05-04 19:59 Ondrej Mosnacek
  2019-05-08 21:51 ` Paul Moore
  0 siblings, 1 reply; 3+ messages in thread
From: Ondrej Mosnacek @ 2019-05-04 19:59 UTC (permalink / raw)
  To: selinux, Paul Moore; +Cc: Stephen Smalley

Since acdf52d97f82 ("selinux: convert to kvmalloc"), these check whether
an address-of value is NULL, which is pointless.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
---
 security/selinux/ss/services.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c
index cc043bc8fd4c..20a089d0aca8 100644
--- a/security/selinux/ss/services.c
+++ b/security/selinux/ss/services.c
@@ -651,9 +651,7 @@ static void context_struct_compute_av(struct policydb *policydb,
 	avkey.target_class = tclass;
 	avkey.specified = AVTAB_AV | AVTAB_XPERMS;
 	sattr = &policydb->type_attr_map_array[scontext->type - 1];
-	BUG_ON(!sattr);
 	tattr = &policydb->type_attr_map_array[tcontext->type - 1];
-	BUG_ON(!tattr);
 	ebitmap_for_each_positive_bit(sattr, snode, i) {
 		ebitmap_for_each_positive_bit(tattr, tnode, j) {
 			avkey.source_type = i + 1;
@@ -1059,9 +1057,7 @@ void security_compute_xperms_decision(struct selinux_state *state,
 	avkey.target_class = tclass;
 	avkey.specified = AVTAB_XPERMS;
 	sattr = &policydb->type_attr_map_array[scontext->type - 1];
-	BUG_ON(!sattr);
 	tattr = &policydb->type_attr_map_array[tcontext->type - 1];
-	BUG_ON(!tattr);
 	ebitmap_for_each_positive_bit(sattr, snode, i) {
 		ebitmap_for_each_positive_bit(tattr, tnode, j) {
 			avkey.source_type = i + 1;
-- 
2.20.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] selinux: remove some no-op BUG_ONs
  2019-05-04 19:59 [PATCH] selinux: remove some no-op BUG_ONs Ondrej Mosnacek
@ 2019-05-08 21:51 ` Paul Moore
  2019-05-21 20:25   ` Paul Moore
  0 siblings, 1 reply; 3+ messages in thread
From: Paul Moore @ 2019-05-08 21:51 UTC (permalink / raw)
  To: Ondrej Mosnacek; +Cc: selinux, Stephen Smalley

On Sat, May 4, 2019 at 3:59 PM Ondrej Mosnacek <omosnace@redhat.com> wrote:
>
> Since acdf52d97f82 ("selinux: convert to kvmalloc"), these check whether
> an address-of value is NULL, which is pointless.
>
> Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
> ---
>  security/selinux/ss/services.c | 4 ----
>  1 file changed, 4 deletions(-)

This looks fine to me, I'll queue this up for after the merge window closes.

> diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c
> index cc043bc8fd4c..20a089d0aca8 100644
> --- a/security/selinux/ss/services.c
> +++ b/security/selinux/ss/services.c
> @@ -651,9 +651,7 @@ static void context_struct_compute_av(struct policydb *policydb,
>         avkey.target_class = tclass;
>         avkey.specified = AVTAB_AV | AVTAB_XPERMS;
>         sattr = &policydb->type_attr_map_array[scontext->type - 1];
> -       BUG_ON(!sattr);
>         tattr = &policydb->type_attr_map_array[tcontext->type - 1];
> -       BUG_ON(!tattr);
>         ebitmap_for_each_positive_bit(sattr, snode, i) {
>                 ebitmap_for_each_positive_bit(tattr, tnode, j) {
>                         avkey.source_type = i + 1;
> @@ -1059,9 +1057,7 @@ void security_compute_xperms_decision(struct selinux_state *state,
>         avkey.target_class = tclass;
>         avkey.specified = AVTAB_XPERMS;
>         sattr = &policydb->type_attr_map_array[scontext->type - 1];
> -       BUG_ON(!sattr);
>         tattr = &policydb->type_attr_map_array[tcontext->type - 1];
> -       BUG_ON(!tattr);
>         ebitmap_for_each_positive_bit(sattr, snode, i) {
>                 ebitmap_for_each_positive_bit(tattr, tnode, j) {
>                         avkey.source_type = i + 1;
> --
> 2.20.1

-- 
paul moore
www.paul-moore.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] selinux: remove some no-op BUG_ONs
  2019-05-08 21:51 ` Paul Moore
@ 2019-05-21 20:25   ` Paul Moore
  0 siblings, 0 replies; 3+ messages in thread
From: Paul Moore @ 2019-05-21 20:25 UTC (permalink / raw)
  To: Ondrej Mosnacek; +Cc: selinux, Stephen Smalley

On Wed, May 8, 2019 at 5:51 PM Paul Moore <paul@paul-moore.com> wrote:
> On Sat, May 4, 2019 at 3:59 PM Ondrej Mosnacek <omosnace@redhat.com> wrote:
> >
> > Since acdf52d97f82 ("selinux: convert to kvmalloc"), these check whether
> > an address-of value is NULL, which is pointless.
> >
> > Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
> > ---
> >  security/selinux/ss/services.c | 4 ----
> >  1 file changed, 4 deletions(-)
>
> This looks fine to me, I'll queue this up for after the merge window closes.

Just merged into selinux/next, thanks.

-- 
paul moore
www.paul-moore.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-04 19:59 [PATCH] selinux: remove some no-op BUG_ONs Ondrej Mosnacek
2019-05-08 21:51 ` Paul Moore
2019-05-21 20:25   ` Paul Moore

SELinux Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/selinux/0 selinux/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 selinux selinux/ https://lore.kernel.org/selinux \
		selinux@vger.kernel.org selinux@archiver.kernel.org
	public-inbox-index selinux

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.selinux


AGPL code for this site: git clone https://public-inbox.org/ public-inbox