linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Cong Wang <amwang@redhat.com>
To: "J. R. Okajima" <hooanon05@yahoo.co.jp>
Cc: opurdila@ixiacom.com, davem@davemloft.net, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] proc_dointvec, write a single value
Date: Tue, 25 May 2010 20:23:47 +0800	[thread overview]
Message-ID: <4BFBC153.9040704@redhat.com> (raw)
In-Reply-To: <1274770184-12611-1-git-send-email-hooanon05@yahoo.co.jp>

On 05/25/10 14:49, 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.
>
> This commit supports writing a single value to a multi-valued entry.
>
> Signed-off-by: J. R. Okajima<hooanon05@yahoo.co.jp>


Reviewed-and-tested-by: WANG Cong <amwang@redhat.com>

Thanks a lot!


> ---
>   kernel/sysctl.c |    4 +++-
>   1 files changed, 3 insertions(+), 1 deletions(-)
>
> diff --git a/kernel/sysctl.c b/kernel/sysctl.c
> index 4c93486..78ac3fb 100644
> --- a/kernel/sysctl.c
> +++ b/kernel/sysctl.c
> @@ -2262,6 +2262,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 +2290,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) {


  reply	other threads:[~2010-05-25 12:19 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-24 14:32 proc_dointvec() and write J. R. Okajima
2010-05-25  4:49 ` Cong Wang
2010-05-25  4:57   ` J. R. Okajima
2010-05-25  5:35     ` Cong Wang
2010-05-25  6:49       ` [PATCH] proc_dointvec, write a single value J. R. Okajima
2010-05-25 12:23         ` Cong Wang [this message]
2010-05-25 23:10           ` David Miller
2010-05-30 15:09             ` Eric W. Biederman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4BFBC153.9040704@redhat.com \
    --to=amwang@redhat.com \
    --cc=davem@davemloft.net \
    --cc=hooanon05@yahoo.co.jp \
    --cc=linux-kernel@vger.kernel.org \
    --cc=opurdila@ixiacom.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).