diff options
author | Jeff Layton <jlayton@redhat.com> | 2012-10-10 15:25:25 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-10-12 00:32:02 -0400 |
commit | e3d6b07b8ba161f638b026feba0c3c97875d7f1c (patch) | |
tree | d40cea06665f9092820d76948d38e329c178011b /kernel/auditsc.c | |
parent | 29e9a3467c1367549568d7d411d5f30209ae181b (diff) |
audit: optimize audit_compare_dname_path
In the cases where we already know the length of the parent, pass it as
a parm so we don't need to recompute it. In the cases where we don't
know the length, pass in AUDIT_NAME_FULL (-1) to indicate that it should
be determined.
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'kernel/auditsc.c')
-rw-r--r-- | kernel/auditsc.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/kernel/auditsc.c b/kernel/auditsc.c index 09c7b6b4f8e6..0160a68b4d7f 100644 --- a/kernel/auditsc.c +++ b/kernel/auditsc.c | |||
@@ -81,9 +81,6 @@ | |||
81 | * a name dynamically and also add those to the list anchored by names_list. */ | 81 | * a name dynamically and also add those to the list anchored by names_list. */ |
82 | #define AUDIT_NAMES 5 | 82 | #define AUDIT_NAMES 5 |
83 | 83 | ||
84 | /* Indicates that audit should log the full pathname. */ | ||
85 | #define AUDIT_NAME_FULL -1 | ||
86 | |||
87 | /* no execve audit message should be longer than this (userspace limits) */ | 84 | /* no execve audit message should be longer than this (userspace limits) */ |
88 | #define MAX_EXECVE_AUDIT_LEN 7500 | 85 | #define MAX_EXECVE_AUDIT_LEN 7500 |
89 | 86 | ||
@@ -2222,7 +2219,7 @@ void __audit_inode_child(const struct inode *parent, | |||
2222 | continue; | 2219 | continue; |
2223 | 2220 | ||
2224 | if (n->ino == parent->i_ino && | 2221 | if (n->ino == parent->i_ino && |
2225 | !audit_compare_dname_path(dname, n->name)) { | 2222 | !audit_compare_dname_path(dname, n->name, n->name_len)) { |
2226 | found_parent = n->name; | 2223 | found_parent = n->name; |
2227 | goto add_names; | 2224 | goto add_names; |
2228 | } | 2225 | } |
@@ -2235,7 +2232,8 @@ void __audit_inode_child(const struct inode *parent, | |||
2235 | 2232 | ||
2236 | /* strcmp() is the more likely scenario */ | 2233 | /* strcmp() is the more likely scenario */ |
2237 | if (!strcmp(dname, n->name) || | 2234 | if (!strcmp(dname, n->name) || |
2238 | !audit_compare_dname_path(dname, n->name)) { | 2235 | !audit_compare_dname_path(dname, n->name, |
2236 | AUDIT_NAME_FULL)) { | ||
2239 | if (inode) | 2237 | if (inode) |
2240 | audit_copy_inode(n, dentry, inode); | 2238 | audit_copy_inode(n, dentry, inode); |
2241 | else | 2239 | else |