diff options
author | Ondrej Mosnacek <omosnace@redhat.com> | 2020-04-28 14:55:12 +0200 |
---|---|---|
committer | Paul Moore <paul@paul-moore.com> | 2020-05-01 16:34:57 -0400 |
commit | 03414a49ad5f3c56988c36d2070e402ffa17feaf (patch) | |
tree | 810a13efb69606650b481efaf4afec11b5abacad /security/selinux/ss/hashtab.h | |
parent | 46619b44e431d85d64a8dfcb7166d0ae098544c8 (diff) | |
download | linux-03414a49ad5f3c56988c36d2070e402ffa17feaf.tar.gz linux-03414a49ad5f3c56988c36d2070e402ffa17feaf.tar.bz2 linux-03414a49ad5f3c56988c36d2070e402ffa17feaf.zip |
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/hashtab.h')
-rw-r--r-- | security/selinux/ss/hashtab.h | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/security/selinux/ss/hashtab.h b/security/selinux/ss/hashtab.h index dde54d9ff01c..31c11511fe10 100644 --- a/security/selinux/ss/hashtab.h +++ b/security/selinux/ss/hashtab.h @@ -35,14 +35,15 @@ struct hashtab_info { }; /* - * Creates a new hash table with the specified characteristics. + * Initializes a new hash table with the specified characteristics. * - * Returns NULL if insufficent space is available or - * the new hash table otherwise. + * Returns -ENOMEM if insufficient space is available or 0 otherwise. */ -struct hashtab *hashtab_create(u32 (*hash_value)(struct hashtab *h, const void *key), - int (*keycmp)(struct hashtab *h, const void *key1, const void *key2), - u32 nel_hint); +int hashtab_init(struct hashtab *h, + u32 (*hash_value)(struct hashtab *h, const void *key), + int (*keycmp)(struct hashtab *h, const void *key1, + const void *key2), + u32 nel_hint); /* * Inserts the specified (key, datum) pair into the specified hash table. |