summaryrefslogtreecommitdiff
path: root/security/selinux/avc.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-05-19 21:22:53 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2011-05-19 21:22:53 -0700
commit257313b2a87795e07a0bdf58d0fffbdba8b31051 (patch)
treeff5043526b0381cdc1f1f68d3c6f8ed3635e0ddb /security/selinux/avc.c
parent044aea9b83614948c98564000db07d1d32b2d29b (diff)
selinux: avoid unnecessary avc cache stat hit count
There is no point in counting hits - we can calculate it from the number of lookups and misses. This makes the avc statistics a bit smaller, and makes the code generation better too. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'security/selinux/avc.c')
-rw-r--r--security/selinux/avc.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/security/selinux/avc.c b/security/selinux/avc.c
index 5971e30e8239..3d2715fd35ea 100644
--- a/security/selinux/avc.c
+++ b/security/selinux/avc.c
@@ -343,11 +343,10 @@ static struct avc_node *avc_lookup(u32 ssid, u32 tsid, u16 tclass)
node = avc_search_node(ssid, tsid, tclass);
if (node)
- avc_cache_stats_incr(hits);
- else
- avc_cache_stats_incr(misses);
+ return node;
- return node;
+ avc_cache_stats_incr(misses);
+ return NULL;
}
static int avc_latest_notif_update(int seqno, int is_insert)
@@ -765,7 +764,7 @@ int avc_has_perm_noaudit(u32 ssid, u32 tsid,
rcu_read_lock();
node = avc_lookup(ssid, tsid, tclass);
- if (!node) {
+ if (unlikely(!node)) {
rcu_read_unlock();
if (in_avd)