From: J. R. Okajima Date: Tue, 25 May 2010 23:10:14 +0000 (-0700) Subject: proc_dointvec: write a single value X-Git-Tag: v3.12-rc1~9544^2~205 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=563b04671017ea00ba563ebeebdc36bce79b1b60;p=kernel%2Fkernel-generic.git proc_dointvec: write a single value The commit 00b7c3395aec3df43de5bd02a3c5a099ca51169f "sysctl: refactor integer handling proc code" modified the behaviour of writing to /proc. Before the commit, write("1\n") to /proc/sys/kernel/printk succeeded. But now it returns EINVAL. This commit supports writing a single value to a multi-valued entry. Signed-off-by: J. R. Okajima Reviewed-and-tested-by: WANG Cong Signed-off-by: David S. Miller --- diff --git a/kernel/sysctl.c b/kernel/sysctl.c index b125830..f948f20 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -2253,6 +2253,8 @@ static int __do_proc_dointvec(void *tbl_data, struct ctl_table *table, if (write) { left -= proc_skip_spaces(&kbuf); + if (!left) + break; err = proc_get_long(&kbuf, &left, &lval, &neg, proc_wspace_sep, sizeof(proc_wspace_sep), NULL); @@ -2279,7 +2281,7 @@ static int __do_proc_dointvec(void *tbl_data, struct ctl_table *table, if (!write && !first && left && !err) err = proc_put_char(&buffer, &left, '\n'); - if (write && !err) + if (write && !err && left) left -= proc_skip_spaces(&kbuf); free: if (write) {