[patch -v2 02/23] binfmt_misc: use simple_read_from_buffer

From: akinobu . mita
Date: Sun Jun 01 2008 - 19:27:54 EST


Signed-off-by: Akinobu Mita <akinobu.mita@xxxxxxxxx>
---
fs/binfmt_misc.c | 20 +++-----------------
1 file changed, 3 insertions(+), 17 deletions(-)

Index: 2.6-git/fs/binfmt_misc.c
===================================================================
--- 2.6-git.orig/fs/binfmt_misc.c
+++ 2.6-git/fs/binfmt_misc.c
@@ -27,6 +27,7 @@
#include <linux/namei.h>
#include <linux/mount.h>
#include <linux/syscalls.h>
+#include <linux/fs.h>

#include <asm/uaccess.h>

@@ -535,31 +536,16 @@ static ssize_t
bm_entry_read(struct file * file, char __user * buf, size_t nbytes, loff_t *ppos)
{
Node *e = file->f_path.dentry->d_inode->i_private;
- loff_t pos = *ppos;
ssize_t res;
char *page;
- int len;

if (!(page = (char*) __get_free_page(GFP_KERNEL)))
return -ENOMEM;

entry_status(e, page);
- len = strlen(page);

- res = -EINVAL;
- if (pos < 0)
- goto out;
- res = 0;
- if (pos >= len)
- goto out;
- if (len < pos + nbytes)
- nbytes = len - pos;
- res = -EFAULT;
- if (copy_to_user(buf, page + pos, nbytes))
- goto out;
- *ppos = pos + nbytes;
- res = nbytes;
-out:
+ res = simple_read_from_buffer(buf, nbytes, ppos, page, strlen(page));
+
free_page((unsigned long) page);
return res;
}

--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/