Skip to content

Commit 5e729e1

Browse files
committed
selinux: avtab_init() and cond_policydb_init() return void
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 <[email protected]> Reviewed-by: Ondrej Mosnacek <[email protected]> Signed-off-by: Paul Moore <[email protected]>
1 parent 34a2dab commit 5e729e1

File tree

5 files changed

+7
-21
lines changed

5 files changed

+7
-21
lines changed

security/selinux/ss/avtab.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -299,12 +299,11 @@ void avtab_destroy(struct avtab *h)
299299
h->mask = 0;
300300
}
301301

302-
int avtab_init(struct avtab *h)
302+
void avtab_init(struct avtab *h)
303303
{
304304
kvfree(h->htable);
305305
h->htable = NULL;
306306
h->nel = 0;
307-
return 0;
308307
}
309308

310309
int avtab_alloc(struct avtab *h, u32 nrules)

security/selinux/ss/avtab.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ struct avtab {
8787
u32 mask; /* mask to compute hash func */
8888
};
8989

90-
int avtab_init(struct avtab *);
90+
void avtab_init(struct avtab *h);
9191
int avtab_alloc(struct avtab *, u32);
9292
struct avtab_datum *avtab_search(struct avtab *h, struct avtab_key *k);
9393
void avtab_destroy(struct avtab *h);

security/selinux/ss/conditional.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -125,19 +125,13 @@ void evaluate_cond_nodes(struct policydb *p)
125125
evaluate_cond_node(p, &p->cond_list[i]);
126126
}
127127

128-
int cond_policydb_init(struct policydb *p)
128+
void cond_policydb_init(struct policydb *p)
129129
{
130-
int rc;
131-
132130
p->bool_val_to_struct = NULL;
133131
p->cond_list = NULL;
134132
p->cond_list_len = 0;
135133

136-
rc = avtab_init(&p->te_cond_avtab);
137-
if (rc)
138-
return rc;
139-
140-
return 0;
134+
avtab_init(&p->te_cond_avtab);
141135
}
142136

143137
static void cond_node_destroy(struct cond_node *node)

security/selinux/ss/conditional.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ struct cond_node {
6161
struct cond_av_list false_list;
6262
};
6363

64-
int cond_policydb_init(struct policydb *p);
64+
void cond_policydb_init(struct policydb *p);
6565
void cond_policydb_destroy(struct policydb *p);
6666

6767
int cond_init_bool_indexes(struct policydb *p);

security/selinux/ss/policydb.c

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -463,17 +463,10 @@ static int rangetr_cmp(struct hashtab *h, const void *k1, const void *k2)
463463
*/
464464
static int policydb_init(struct policydb *p)
465465
{
466-
int rc;
467-
468466
memset(p, 0, sizeof(*p));
469467

470-
rc = avtab_init(&p->te_avtab);
471-
if (rc)
472-
return rc;
473-
474-
rc = cond_policydb_init(p);
475-
if (rc)
476-
return rc;
468+
avtab_init(&p->te_avtab);
469+
cond_policydb_init(p);
477470

478471
p->filename_trans = hashtab_create(filenametr_hash, filenametr_cmp,
479472
(1 << 11));

0 commit comments

Comments
 (0)