summaryrefslogtreecommitdiff
path: root/security/selinux/ss/symtab.c
diff options
context:
space:
mode:
authorOndrej Mosnacek <omosnace@redhat.com>2020-04-28 14:55:12 +0200
committerPaul Moore <paul@paul-moore.com>2020-05-01 16:34:57 -0400
commit03414a49ad5f3c56988c36d2070e402ffa17feaf (patch)
tree810a13efb69606650b481efaf4afec11b5abacad /security/selinux/ss/symtab.c
parent46619b44e431d85d64a8dfcb7166d0ae098544c8 (diff)
selinux: do not allocate hashtabs dynamically
It is simpler to allocate them statically in the corresponding structure, avoiding unnecessary kmalloc() calls and pointer dereferencing. Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com> [PM: manual merging required in policydb.c] Signed-off-by: Paul Moore <paul@paul-moore.com>
Diffstat (limited to 'security/selinux/ss/symtab.c')
-rw-r--r--security/selinux/ss/symtab.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/security/selinux/ss/symtab.c b/security/selinux/ss/symtab.c
index dc2ce94165d3..92d7a948070e 100644
--- a/security/selinux/ss/symtab.c
+++ b/security/selinux/ss/symtab.c
@@ -35,10 +35,7 @@ static int symcmp(struct hashtab *h, const void *key1, const void *key2)
int symtab_init(struct symtab *s, unsigned int size)
{
- s->table = hashtab_create(symhash, symcmp, size);
- if (!s->table)
- return -ENOMEM;
s->nprim = 0;
- return 0;
+ return hashtab_init(&s->table, symhash, symcmp, size);
}