[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1211148109-16149-1-git-send-email-marcin.slusarz@gmail.com>
Date: Mon, 19 May 2008 00:01:49 +0200
From: Marcin Slusarz <marcin.slusarz@...il.com>
To: LKML <linux-kernel@...r.kernel.org>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Al Viro <viro@...IV.linux.org.uk>,
Christoph Hellwig <hch@....de>
Subject: [PATCH 3/6] vfs: open_exec cleanup
open_exec is needlessly indented, calls ERR_PTR with 0 argument
(which is not valid errno) and jumps into middle of function
just to return value.
So clean it up a bit.
Signed-off-by: Marcin Slusarz <marcin.slusarz@...il.com>
Cc: Al Viro <viro@...iv.linux.org.uk>
Cc: Andrew Morton <akpm@...ux-foundation.org>
---
fs/exec.c | 44 ++++++++++++++++++++++----------------------
1 files changed, 22 insertions(+), 22 deletions(-)
diff --git a/fs/exec.c b/fs/exec.c
index aeaa979..ca8b512 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -656,34 +656,34 @@ struct file *open_exec(const char *name)
struct nameidata nd;
int err;
struct file *file;
+ struct inode *inode;
err = path_lookup_open(AT_FDCWD, name, LOOKUP_FOLLOW, &nd, FMODE_READ|FMODE_EXEC);
- file = ERR_PTR(err);
-
- if (!err) {
- struct inode *inode = nd.path.dentry->d_inode;
- file = ERR_PTR(-EACCES);
- if (S_ISREG(inode->i_mode)) {
- int err = vfs_permission(&nd, MAY_EXEC);
- file = ERR_PTR(err);
- if (!err) {
- file = nameidata_to_filp(&nd,
- O_RDONLY|O_LARGEFILE);
- if (!IS_ERR(file)) {
- err = deny_write_access(file);
- if (err) {
- fput(file);
- file = ERR_PTR(err);
- }
+ if (err)
+ return ERR_PTR(err);
+
+ inode = nd.path.dentry->d_inode;
+ file = ERR_PTR(-EACCES);
+ if (S_ISREG(inode->i_mode)) {
+ int err = vfs_permission(&nd, MAY_EXEC);
+ if (!err) {
+ file = nameidata_to_filp(&nd, O_RDONLY|O_LARGEFILE);
+ if (!IS_ERR(file)) {
+ err = deny_write_access(file);
+ if (err) {
+ fput(file);
+ file = ERR_PTR(err);
}
-out:
- return file;
}
+ goto out;
}
- release_open_intent(&nd);
- path_put(&nd.path);
+ else
+ file = ERR_PTR(err);
}
- goto out;
+ release_open_intent(&nd);
+ path_put(&nd.path);
+out:
+ return file;
}
EXPORT_SYMBOL(open_exec);
--
1.5.4.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists