Loading fs/binfmt_misc.c +3 −17 Original line number Original line Diff line number Diff line Loading @@ -27,6 +27,7 @@ #include <linux/namei.h> #include <linux/namei.h> #include <linux/mount.h> #include <linux/mount.h> #include <linux/syscalls.h> #include <linux/syscalls.h> #include <linux/fs.h> #include <asm/uaccess.h> #include <asm/uaccess.h> Loading Loading @@ -535,31 +536,16 @@ static ssize_t bm_entry_read(struct file * file, char __user * buf, size_t nbytes, loff_t *ppos) 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; Node *e = file->f_path.dentry->d_inode->i_private; loff_t pos = *ppos; ssize_t res; ssize_t res; char *page; char *page; int len; if (!(page = (char*) __get_free_page(GFP_KERNEL))) if (!(page = (char*) __get_free_page(GFP_KERNEL))) return -ENOMEM; return -ENOMEM; entry_status(e, page); entry_status(e, page); len = strlen(page); res = -EINVAL; res = simple_read_from_buffer(buf, nbytes, ppos, page, strlen(page)); 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: free_page((unsigned long) page); free_page((unsigned long) page); return res; return res; } } Loading Loading
fs/binfmt_misc.c +3 −17 Original line number Original line Diff line number Diff line Loading @@ -27,6 +27,7 @@ #include <linux/namei.h> #include <linux/namei.h> #include <linux/mount.h> #include <linux/mount.h> #include <linux/syscalls.h> #include <linux/syscalls.h> #include <linux/fs.h> #include <asm/uaccess.h> #include <asm/uaccess.h> Loading Loading @@ -535,31 +536,16 @@ static ssize_t bm_entry_read(struct file * file, char __user * buf, size_t nbytes, loff_t *ppos) 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; Node *e = file->f_path.dentry->d_inode->i_private; loff_t pos = *ppos; ssize_t res; ssize_t res; char *page; char *page; int len; if (!(page = (char*) __get_free_page(GFP_KERNEL))) if (!(page = (char*) __get_free_page(GFP_KERNEL))) return -ENOMEM; return -ENOMEM; entry_status(e, page); entry_status(e, page); len = strlen(page); res = -EINVAL; res = simple_read_from_buffer(buf, nbytes, ppos, page, strlen(page)); 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: free_page((unsigned long) page); free_page((unsigned long) page); return res; return res; } } Loading