selinux: avtab_init() and cond_policydb_init() return void
authorPaul Moore <paul@paul-moore.com>
Thu, 5 Mar 2020 19:55:43 +0000 (14:55 -0500)
committerPaul Moore <paul@paul-moore.com>
Thu, 5 Mar 2020 19:55:43 +0000 (14:55 -0500)
The avtab_init() and cond_policydb_init() functions always return
zero so mark them as returning void and update the callers not to
check for a return value.

Suggested-by: Stephen Smalley <stephen.smalley.work@gmail.com>
Reviewed-by: Ondrej Mosnacek <omosnace@redhat.com>
Signed-off-by: Paul Moore <paul@paul-moore.com>
security/selinux/ss/avtab.c
security/selinux/ss/avtab.h
security/selinux/ss/conditional.c
security/selinux/ss/conditional.h
security/selinux/ss/policydb.c

index 8c5800750fa85ba4ac329f70e52b8ced05e13ad7..01b300a4a882d1dd5d428120e46d6e19b668fe70 100644 (file)
@@ -299,12 +299,11 @@ void avtab_destroy(struct avtab *h)
        h->mask = 0;
 }
 
-int avtab_init(struct avtab *h)
+void avtab_init(struct avtab *h)
 {
        kvfree(h->htable);
        h->htable = NULL;
        h->nel = 0;
-       return 0;
 }
 
 int avtab_alloc(struct avtab *h, u32 nrules)
index 837e938798efeafbd61bee6a777ff7816f8ce1aa..5fdcb6696bcc070f9224e44177b5b587f5934678 100644 (file)
@@ -87,7 +87,7 @@ struct avtab {
        u32 mask;       /* mask to compute hash func */
 };
 
-int avtab_init(struct avtab *);
+void avtab_init(struct avtab *h);
 int avtab_alloc(struct avtab *, u32);
 struct avtab_datum *avtab_search(struct avtab *h, struct avtab_key *k);
 void avtab_destroy(struct avtab *h);
index cce4a75fb3e73332a897a77c93ad425f6ffd604c..939a74fd8fb470e68ef6fd9172a11fd2e42679d4 100644 (file)
@@ -125,19 +125,13 @@ void evaluate_cond_nodes(struct policydb *p)
                evaluate_cond_node(p, &p->cond_list[i]);
 }
 
-int cond_policydb_init(struct policydb *p)
+void cond_policydb_init(struct policydb *p)
 {
-       int rc;
-
        p->bool_val_to_struct = NULL;
        p->cond_list = NULL;
        p->cond_list_len = 0;
 
-       rc = avtab_init(&p->te_cond_avtab);
-       if (rc)
-               return rc;
-
-       return 0;
+       avtab_init(&p->te_cond_avtab);
 }
 
 static void cond_node_destroy(struct cond_node *node)
index b9eb888ffa76ca33cb9b8326f8b93576fe5e6d81..90c9c964f5f5510285bdd31b7fc28991e431c498 100644 (file)
@@ -61,7 +61,7 @@ struct cond_node {
        struct cond_av_list false_list;
 };
 
-int cond_policydb_init(struct policydb *p);
+void cond_policydb_init(struct policydb *p);
 void cond_policydb_destroy(struct policydb *p);
 
 int cond_init_bool_indexes(struct policydb *p);
index 00edcd216aaac33962c7d896526abbe9a939fae3..932b2b9bcdb2bd43aac7686abbd386fb65074ce2 100644 (file)
@@ -463,17 +463,10 @@ static int rangetr_cmp(struct hashtab *h, const void *k1, const void *k2)
  */
 static int policydb_init(struct policydb *p)
 {
-       int rc;
-
        memset(p, 0, sizeof(*p));
 
-       rc = avtab_init(&p->te_avtab);
-       if (rc)
-               return rc;
-
-       rc = cond_policydb_init(p);
-       if (rc)
-               return rc;
+       avtab_init(&p->te_avtab);
+       cond_policydb_init(p);
 
        p->filename_trans = hashtab_create(filenametr_hash, filenametr_cmp,
                                           (1 << 11));