Prev: : Fix userspace warnings in elfcore.h
Next: [PATCH v3 3/3] dm: lookup devices by path with name_to_dev_t
From: J. R. Okajima on 24 May 2010 10:40 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. Is this intended change? If not, how about this patch? J. R. Okajima diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 4c93486..5058e12 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -2262,6 +2272,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); @@ -2288,7 +2306,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) { -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
From: Cong Wang on 25 May 2010 00:50 On 05/24/10 22:32, J. R. Okajima wrote: > 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. Is this intended change? If not, how about this > patch? > Hmm, odd, I tested other proc files, I see no problem. I am wondering why /proc/sys/kernel/printk is special here. I will be back later. > > J. R. Okajima > > diff --git a/kernel/sysctl.c b/kernel/sysctl.c > index 4c93486..5058e12 100644 > --- a/kernel/sysctl.c > +++ b/kernel/sysctl.c > @@ -2262,6 +2272,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); > @@ -2288,7 +2306,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) { > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
From: J. R. Okajima on 25 May 2010 01:00 Cong Wang: > Hmm, odd, I tested other proc files, I see no problem. > I am wondering why /proc/sys/kernel/printk is special here. The condition is, - the entry has multiple values, .maxlen = N * sizeof(foo) - the entry is writable, .mode = 0644 (or something) In sysctl.c, only "printk" and "acct" match. J. R. Okajima -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
From: Cong Wang on 25 May 2010 01:40
On 05/25/10 12:57, J. R. Okajima wrote: > Cong Wang: >> Hmm, odd, I tested other proc files, I see no problem. >> I am wondering why /proc/sys/kernel/printk is special here. > > The condition is, > - the entry has multiple values, .maxlen = N * sizeof(foo) > - the entry is writable, .mode = 0644 (or something) > > In sysctl.c, only "printk" and "acct" match. Hmm, right, I missed this case during testing. Your patch looks correct for me. Would you mind to send your patch again with your Signed-off-by? Thank you! -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ |