]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
proc: pass "fd" by value in /proc/*/{fd,fdinfo} code
authorAlexey Dobriyan <adobriyan@gmail.com>
Thu, 3 May 2012 05:44:41 +0000 (15:44 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Thu, 3 May 2012 05:46:55 +0000 (15:46 +1000)
Pass "fd" directly, not via pointer -- one less memory read.

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
fs/proc/base.c

index ee7534205422a94d780a69b31092d28e889b9dea..84192c0d10691ebcdf4d449d97f1c39a56c1157e 100644 (file)
@@ -1834,7 +1834,7 @@ static const struct dentry_operations tid_fd_dentry_operations =
 static struct dentry *proc_fd_instantiate(struct inode *dir,
        struct dentry *dentry, struct task_struct *task, const void *ptr)
 {
-       unsigned fd = *(const unsigned *)ptr;
+       unsigned fd = (unsigned long)ptr;
        struct file *file;
        struct files_struct *files;
        struct inode *inode;
@@ -1898,7 +1898,7 @@ static struct dentry *proc_lookupfd_common(struct inode *dir,
        if (fd == ~0U)
                goto out;
 
-       result = instantiate(dir, dentry, task, &fd);
+       result = instantiate(dir, dentry, task, (void *)(unsigned long)fd);
 out:
        put_task_struct(task);
 out_no_task:
@@ -1950,7 +1950,7 @@ static int proc_readfd_common(struct file * filp, void * dirent,
                                len = snprintf(name, sizeof(name), "%d", fd);
                                rv = proc_fill_cache(filp, dirent, filldir,
                                                     name, len, instantiate, p,
-                                                    &fd);
+                                                    (void *)(unsigned long)fd);
                                if (rv < 0)
                                        goto out_fd_loop;
                                rcu_read_lock();
@@ -2370,7 +2370,7 @@ static const struct inode_operations proc_fd_inode_operations = {
 static struct dentry *proc_fdinfo_instantiate(struct inode *dir,
        struct dentry *dentry, struct task_struct *task, const void *ptr)
 {
-       unsigned fd = *(unsigned *)ptr;
+       unsigned fd = (unsigned long)ptr;
        struct inode *inode;
        struct proc_inode *ei;
        struct dentry *error = ERR_PTR(-ENOENT);