diff mbox series

selinux: remove some no-op BUG_ONs

Message ID 20190504195906.8146-1-omosnace@redhat.com (mailing list archive)
State Accepted
Headers show
Series selinux: remove some no-op BUG_ONs | expand

Commit Message

Ondrej Mosnacek May 4, 2019, 7:59 p.m. UTC
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(-)

Comments

Paul Moore May 8, 2019, 9:51 p.m. UTC | #1
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 May 21, 2019, 8:25 p.m. UTC | #2
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.
diff mbox series

Patch

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;