From: Jeff Layton Date: Wed, 10 Oct 2012 19:25:21 +0000 (-0400) Subject: audit: no need to walk list in audit_inode if name is NULL X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=9cec9d68ae53aae60b4a1fca4505c75a1d026392;p=GitHub%2FLineageOS%2Fandroid_kernel_samsung_universal7580.git 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 Signed-off-by: Al Viro --- diff --git a/kernel/auditsc.c b/kernel/auditsc.c index 4d1bd62b090..2e481141b01 100644 --- a/kernel/auditsc.c +++ b/kernel/auditsc.c @@ -2147,11 +2147,15 @@ void __audit_inode(const char *name, const struct dentry *dentry) if (!context->in_syscall) return; + if (!name) + goto out_alloc; + list_for_each_entry_reverse(n, &context->names_list, list) { - if (n->name && (n->name == name)) + if (n->name == name) goto out; } +out_alloc: /* unable to find the name from a previous getname() */ n = audit_alloc_name(context); if (!n)