From: Yisheng Xie <xieyisheng1@huawei.com>
To: <subashab@codeaurora.org>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Arnaldo Carvalho de Melo <acme@redhat.com>,
"Mel Gorman" <mgorman@techsingularity.net>,
Al Viro <viro@zeniv.linux.org.uk>,
Johannes Weiner <hannes@cmpxchg.org>,
"Eric W. Biederman" <ebiederm@xmission.com>,
Daniel Bristot de Oliveira <bristot@redhat.com>,
Daniel Cashman <dcashman@google.com>, Willy Tarreau <w@1wt.eu>,
Arnd Bergmann <arnd@arndb.de>, Hanjun Guo <guohanjun@huawei.com>,
Xishi Qiu <qiuxishi@huawei.com>
Subject: Re: [RFC] kernel/sysctl.c: return -EINVAL when write invalid val to ulong type sysctl
Date: Tue, 29 Nov 2016 18:24:21 +0800 [thread overview]
Message-ID: <dcc5a4e2-978e-a087-13b6-43a804eb1934@huawei.com> (raw)
In-Reply-To: <6d58a831975bfebea981289c6a1fd4bc@codeaurora.org>
On 2016/11/27 7:15, subashab@codeaurora.org wrote:
> On 2016-11-26 02:13, Yisheng Xie wrote:
>> ----------------------
>> diff --git a/kernel/sysctl.c b/kernel/sysctl.c
>> index 706309f..40e9285 100644
>> --- a/kernel/sysctl.c
>> +++ b/kernel/sysctl.c
>> @@ -2485,10 +2485,14 @@ static int __do_proc_doulongvec_minmax(void
>> *data, struct ctl_table *table, int
>> sizeof(proc_wspace_sep), NULL);
>> if (err)
>> break;
>> - if (neg)
>> - continue;
>> - if ((min && val < *min) || (max && val > *max))
>> - continue;
>> + if (neg) {
>> + err = -EINVAL;
>> + break;
>> + }
>> + if ((min && val < *min) || (max && val > *max)) {
>> + err = -EINVAL;
>> + break;
>> + }
>> *i = val;
>> } else {
>> val = convdiv * (*i) / convmul;
>
> Agree, this should be similar to proc_douintvec
>
> root@vm:~# echo 8192 > /proc/sys/net/core/xfrm_aevent_rseqth
> root@vm:~# cat /proc/sys/net/core/xfrm_aevent_rseqth
> 8192
> root@vm:~# echo -1 > /proc/sys/net/core/xfrm_aevent_rseqth
> -bash: echo: write error: Invalid argument
> root@vm:~# cat /proc/sys/net/core/xfrm_aevent_rseqth
> 8192
>
Hi,
Thank you for your reply,
then I will write a formal patch to see whether it is acceptable.
Thanks,
Yisheng Xie
> --
> Qualcomm Innovation Center, Inc.
> The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
>
> .
>
prev parent reply other threads:[~2016-11-29 10:26 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-26 9:13 [RFC] kernel/sysctl.c: return -EINVAL when write invalid val to ulong type sysctl Yisheng Xie
2016-11-26 23:15 ` subashab
2016-11-29 10:24 ` Yisheng Xie [this message]
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=dcc5a4e2-978e-a087-13b6-43a804eb1934@huawei.com \
--to=xieyisheng1@huawei.com \
--cc=acme@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=arnd@arndb.de \
--cc=bristot@redhat.com \
--cc=dcashman@google.com \
--cc=ebiederm@xmission.com \
--cc=guohanjun@huawei.com \
--cc=hannes@cmpxchg.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mgorman@techsingularity.net \
--cc=qiuxishi@huawei.com \
--cc=subashab@codeaurora.org \
--cc=viro@zeniv.linux.org.uk \
--cc=w@1wt.eu \
/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).