[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <dcc5a4e2-978e-a087-13b6-43a804eb1934@huawei.com>
Date: Tue, 29 Nov 2016 18:24:21 +0800
From: Yisheng Xie <xieyisheng1@...wei.com>
To: <subashab@...eaurora.org>
CC: Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Arnaldo Carvalho de Melo <acme@...hat.com>,
"Mel Gorman" <mgorman@...hsingularity.net>,
Al Viro <viro@...iv.linux.org.uk>,
Johannes Weiner <hannes@...xchg.org>,
"Eric W. Biederman" <ebiederm@...ssion.com>,
Daniel Bristot de Oliveira <bristot@...hat.com>,
Daniel Cashman <dcashman@...gle.com>, Willy Tarreau <w@....eu>,
Arnd Bergmann <arnd@...db.de>,
Hanjun Guo <guohanjun@...wei.com>,
Xishi Qiu <qiuxishi@...wei.com>
Subject: Re: [RFC] kernel/sysctl.c: return -EINVAL when write invalid val to
ulong type sysctl
On 2016/11/27 7:15, subashab@...eaurora.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
>
> .
>
Powered by blists - more mailing lists