diff options
author | Paul Moore | 2023-11-10 15:46:49 -0500 |
---|---|---|
committer | Paul Moore | 2023-11-16 12:45:33 -0500 |
commit | a67d2a14a77eed5dbdace1801bf2255962121bdb (patch) | |
tree | 9ab3cfb8d80ca7affe7d94065b5c9cc79ea0b87b /security | |
parent | 4a0b33f771db2b82fdfad08b9f34def786162865 (diff) |
selinux: update filenametr_hash() to use full_name_hash()
Using full_name_hash() instead of partial_name_hash() should result
in cleaner and better performing code.
Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Paul Moore <paul@paul-moore.com>
Diffstat (limited to 'security')
-rw-r--r-- | security/selinux/ss/policydb.c | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/security/selinux/ss/policydb.c b/security/selinux/ss/policydb.c index 595a435ea9c8..bd1e7f26d951 100644 --- a/security/selinux/ss/policydb.c +++ b/security/selinux/ss/policydb.c @@ -409,16 +409,9 @@ out: static u32 filenametr_hash(const void *k) { const struct filename_trans_key *ft = k; - unsigned long hash; - unsigned int byte_num; - unsigned char focus; + unsigned long salt = ft->ttype ^ ft->tclass; - hash = ft->ttype ^ ft->tclass; - - byte_num = 0; - while ((focus = ft->name[byte_num++])) - hash = partial_name_hash(focus, hash); - return hash; + return full_name_hash((void *)salt, ft->name, strlen(ft->name)); } static int filenametr_cmp(const void *k1, const void *k2) |