Commit 85badbdf5120d246ce2bb3f1a7689a805f9c9006
Committed by
Linus Torvalds
1 parent
92f4c701aa
use simple_read_from_buffer in kernel/
Cleanup using simple_read_from_buffer() for /dev/cpuset/tasks and /proc/config.gz. Cc: Paul Jackson <pj@sgi.com> Cc: Randy Dunlap <rdunlap@xenotime.net> Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Showing 2 changed files with 4 additions and 18 deletions Side-by-side Diff
kernel/configs.c
... | ... | @@ -61,18 +61,9 @@ |
61 | 61 | ikconfig_read_current(struct file *file, char __user *buf, |
62 | 62 | size_t len, loff_t * offset) |
63 | 63 | { |
64 | - loff_t pos = *offset; | |
65 | - ssize_t count; | |
66 | - | |
67 | - if (pos >= kernel_config_data_size) | |
68 | - return 0; | |
69 | - | |
70 | - count = min(len, (size_t)(kernel_config_data_size - pos)); | |
71 | - if (copy_to_user(buf, kernel_config_data + MAGIC_SIZE + pos, count)) | |
72 | - return -EFAULT; | |
73 | - | |
74 | - *offset += count; | |
75 | - return count; | |
64 | + return simple_read_from_buffer(buf, len, offset, | |
65 | + kernel_config_data + MAGIC_SIZE, | |
66 | + kernel_config_data_size); | |
76 | 67 | } |
77 | 68 | |
78 | 69 | static const struct file_operations ikconfig_file_ops = { |
kernel/cpuset.c
... | ... | @@ -1772,12 +1772,7 @@ |
1772 | 1772 | { |
1773 | 1773 | struct ctr_struct *ctr = file->private_data; |
1774 | 1774 | |
1775 | - if (*ppos + nbytes > ctr->bufsz) | |
1776 | - nbytes = ctr->bufsz - *ppos; | |
1777 | - if (copy_to_user(buf, ctr->buf + *ppos, nbytes)) | |
1778 | - return -EFAULT; | |
1779 | - *ppos += nbytes; | |
1780 | - return nbytes; | |
1775 | + return simple_read_from_buffer(buf, nbytes, ppos, ctr->buf, ctr->bufsz); | |
1781 | 1776 | } |
1782 | 1777 | |
1783 | 1778 | static int cpuset_tasks_release(struct inode *unused_inode, struct file *file) |