diff options
Diffstat (limited to 'tags/2.6.18-11/30027_cpuset_tasks-underflow.patch')
-rw-r--r-- | tags/2.6.18-11/30027_cpuset_tasks-underflow.patch | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/tags/2.6.18-11/30027_cpuset_tasks-underflow.patch b/tags/2.6.18-11/30027_cpuset_tasks-underflow.patch new file mode 100644 index 0000000..254ce0f --- /dev/null +++ b/tags/2.6.18-11/30027_cpuset_tasks-underflow.patch @@ -0,0 +1,61 @@ +From: Akinobu Mita <akinobu.mita@gmail.com> +Date: Wed, 9 May 2007 09:33:33 +0000 (-0700) +Subject: use simple_read_from_buffer in kernel/ +X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Fstable%2Flinux-2.6.20.y.git;a=commitdiff_plain;h=85badbdf5120d246ce2bb3f1a7689a805f9c9006 + +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> +--- + +Backported to Debian's 2.6.18 by dann frazier <dannf@debian.org> + +diff -urpN linux-source-2.6.18.orig/kernel/configs.c linux-source-2.6.18/kernel/configs.c +--- linux-source-2.6.18.orig/kernel/configs.c 2006-09-19 21:42:06.000000000 -0600 ++++ linux-source-2.6.18/kernel/configs.c 2007-08-27 22:30:10.774211736 -0600 +@@ -61,18 +61,9 @@ static ssize_t + ikconfig_read_current(struct file *file, char __user *buf, + size_t len, loff_t * offset) + { +- loff_t pos = *offset; +- ssize_t count; +- +- if (pos >= kernel_config_data_size) +- return 0; +- +- count = min(len, (size_t)(kernel_config_data_size - pos)); +- if (copy_to_user(buf, kernel_config_data + MAGIC_SIZE + pos, count)) +- return -EFAULT; +- +- *offset += count; +- return count; ++ return simple_read_from_buffer(buf, len, offset, ++ kernel_config_data + MAGIC_SIZE, ++ kernel_config_data_size); + } + + static struct file_operations ikconfig_file_ops = { +diff -urpN linux-source-2.6.18.orig/kernel/cpuset.c linux-source-2.6.18/kernel/cpuset.c +--- linux-source-2.6.18.orig/kernel/cpuset.c 2006-09-19 21:42:06.000000000 -0600 ++++ linux-source-2.6.18/kernel/cpuset.c 2007-08-27 22:30:10.778211823 -0600 +@@ -1743,12 +1743,7 @@ static ssize_t cpuset_tasks_read(struct + { + struct ctr_struct *ctr = file->private_data; + +- if (*ppos + nbytes > ctr->bufsz) +- nbytes = ctr->bufsz - *ppos; +- if (copy_to_user(buf, ctr->buf + *ppos, nbytes)) +- return -EFAULT; +- *ppos += nbytes; +- return nbytes; ++ return simple_read_from_buffer(buf, nbytes, ppos, ctr->buf, ctr->bufsz); + } + + static int cpuset_tasks_release(struct inode *unused_inode, struct file *file) |