Skip to content

Commit

Permalink
SELinux: drop useless (and incorrect) AVTAB_MAX_SIZE
Browse files Browse the repository at this point in the history
AVTAB_MAX_SIZE was a define which was supposed to be used in userspace to
define a maximally sized avtab when userspace wasn't sure how big of a table
it needed.  It doesn't make sense in the kernel since we always know our table
sizes.  The only place it is used we have a more appropiately named define
called AVTAB_MAX_HASH_BUCKETS, use that instead.

Signed-off-by: Eric Paris <eparis@redhat.com>
Signed-off-by: James Morris <jmorris@namei.org>
  • Loading branch information
Eric Paris authored and James Morris committed Oct 20, 2010
1 parent 4419aae commit 00d85c8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
4 changes: 2 additions & 2 deletions security/selinux/ss/avtab.c
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,8 @@ int avtab_alloc(struct avtab *h, u32 nrules)
if (shift > 2)
shift = shift - 2;
nslot = 1 << shift;
if (nslot > MAX_AVTAB_SIZE)
nslot = MAX_AVTAB_SIZE;
if (nslot > MAX_AVTAB_HASH_BUCKETS)
nslot = MAX_AVTAB_HASH_BUCKETS;
mask = nslot - 1;

h->htable = kcalloc(nslot, sizeof(*(h->htable)), GFP_KERNEL);
Expand Down
1 change: 0 additions & 1 deletion security/selinux/ss/avtab.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ void avtab_cache_destroy(void);
#define MAX_AVTAB_HASH_BITS 11
#define MAX_AVTAB_HASH_BUCKETS (1 << MAX_AVTAB_HASH_BITS)
#define MAX_AVTAB_HASH_MASK (MAX_AVTAB_HASH_BUCKETS-1)
#define MAX_AVTAB_SIZE MAX_AVTAB_HASH_BUCKETS

#endif /* _SS_AVTAB_H_ */

0 comments on commit 00d85c8

Please sign in to comment.