diff options
author | Jeff Layton <jlayton@redhat.com> | 2012-10-10 15:25:21 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-10-12 00:31:59 -0400 |
commit | 9cec9d68ae53aae60b4a1fca4505c75a1d026392 (patch) | |
tree | da913dbacdb569b382182beb70c660ac93a39e5a /kernel | |
parent | 1c2e51e8c162417d2831007ec256ede06c3a0201 (diff) |
audit: no need to walk list in audit_inode if name is NULL
If name is NULL then the condition in the loop will never be true. Also,
with this change, we can eliminate the check for n->name == NULL since
the equivalence check will never be true if it is.
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/auditsc.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/kernel/auditsc.c b/kernel/auditsc.c index 4d1bd62b090b..2e481141b014 100644 --- a/kernel/auditsc.c +++ b/kernel/auditsc.c | |||
@@ -2147,11 +2147,15 @@ void __audit_inode(const char *name, const struct dentry *dentry) | |||
2147 | if (!context->in_syscall) | 2147 | if (!context->in_syscall) |
2148 | return; | 2148 | return; |
2149 | 2149 | ||
2150 | if (!name) | ||
2151 | goto out_alloc; | ||
2152 | |||
2150 | list_for_each_entry_reverse(n, &context->names_list, list) { | 2153 | list_for_each_entry_reverse(n, &context->names_list, list) { |
2151 | if (n->name && (n->name == name)) | 2154 | if (n->name == name) |
2152 | goto out; | 2155 | goto out; |
2153 | } | 2156 | } |
2154 | 2157 | ||
2158 | out_alloc: | ||
2155 | /* unable to find the name from a previous getname() */ | 2159 | /* unable to find the name from a previous getname() */ |
2156 | n = audit_alloc_name(context); | 2160 | n = audit_alloc_name(context); |
2157 | if (!n) | 2161 | if (!n) |