Commit 4043cde8 authored by Eric Paris's avatar Eric Paris Committed by Al Viro

audit: do not call audit_getname on error

Just a code cleanup really.  We don't need to make a function call just for
it to return on error.  This also makes the VFS function even easier to follow
and removes a conditional on a hot path.
Signed-off-by: default avatarEric Paris <eparis@redhat.com>
parent 633b4545
...@@ -140,21 +140,19 @@ static int do_getname(const char __user *filename, char *page) ...@@ -140,21 +140,19 @@ static int do_getname(const char __user *filename, char *page)
static char *getname_flags(const char __user *filename, int flags, int *empty) static char *getname_flags(const char __user *filename, int flags, int *empty)
{ {
char *tmp, *result; char *result = __getname();
int retval;
result = ERR_PTR(-ENOMEM);
tmp = __getname(); if (!result)
if (tmp) { return ERR_PTR(-ENOMEM);
int retval = do_getname(filename, tmp);
retval = do_getname(filename, result);
result = tmp; if (retval < 0) {
if (retval < 0) { if (retval == -ENOENT && empty)
if (retval == -ENOENT && empty) *empty = 1;
*empty = 1; if (retval != -ENOENT || !(flags & LOOKUP_EMPTY)) {
if (retval != -ENOENT || !(flags & LOOKUP_EMPTY)) { __putname(result);
__putname(tmp); return ERR_PTR(retval);
result = ERR_PTR(retval);
}
} }
} }
audit_getname(result); audit_getname(result);
......
...@@ -1913,9 +1913,6 @@ void __audit_getname(const char *name) ...@@ -1913,9 +1913,6 @@ void __audit_getname(const char *name)
struct audit_context *context = current->audit_context; struct audit_context *context = current->audit_context;
struct audit_names *n; struct audit_names *n;
if (IS_ERR(name) || !name)
return;
if (!context->in_syscall) { if (!context->in_syscall) {
#if AUDIT_DEBUG == 2 #if AUDIT_DEBUG == 2
printk(KERN_ERR "%s:%d(:%d): ignoring getname(%p)\n", printk(KERN_ERR "%s:%d(:%d): ignoring getname(%p)\n",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment