From: Andrew Morton <akpm@linux-foundation.org>
To: Yisheng Xie <xieyisheng1@huawei.com>
Cc: <linux-kernel@vger.kernel.org>, <acme@redhat.com>,
<mgorman@techsingularity.net>, <viro@zeniv.linux.org.uk>,
<hannes@cmpxchg.org>, <ebiederm@xmission.com>,
<bristot@redhat.com>, <subashab@codeaurora.org>,
<dcashman@google.com>, <w@1wt.eu>, <arnd@arndb.de>,
<guohanjun@huawei.com>, <qiuxishi@huawei.com>
Subject: Re: [PATCH] kernel/sysctl: return -EINVAL if write invalid val to ulong type sysctl
Date: Wed, 30 Nov 2016 13:33:58 -0800 [thread overview]
Message-ID: <20161130133358.d508cc8931be6f08ee88561f@linux-foundation.org> (raw)
In-Reply-To: <1480501852-36968-1-git-send-email-xieyisheng1@huawei.com>
On Wed, 30 Nov 2016 18:30:52 +0800 Yisheng Xie <xieyisheng1@huawei.com> wrote:
> I tried to echo an invalid value to an unsigned long type sysctl on
> 4.9.0-rc6:
> linux:~# cat /proc/sys/vm/user_reserve_kbytes
> 131072
> linux:~# echo -1 > /proc/sys/vm/user_reserve_kbytes
> linux:~# cat /proc/sys/vm/user_reserve_kbytes
> 131072
>
> The echo operation got error and the value do not write to
> user_reserve_kbytes, however, user do not know it until checking
> the value again.
>
> This patch return -EINVAL when write an invalid value to unsigned
> long type sysctl to make user know what happened without
> checking its value once more, just as what proc_douintvec do.
hmpf.
# echo 18446744073709551615 > /proc/sys/vm/user_reserve_kbytes
# cat /proc/sys/vm/user_reserve_kbytes
18446744073709551615
I think that when taking in an unsigned long the kernel should simply
treat -1 as 0xffffffff (or 0xffffffffffffffff). It's natural and
normal and everyone knows what it means?
next prev parent reply other threads:[~2016-11-30 21:33 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-30 10:30 Yisheng Xie
2016-11-30 21:33 ` Andrew Morton [this message]
2016-12-02 6:54 ` Yisheng Xie
2016-12-02 19:24 ` Eric W. Biederman
2016-12-05 6:12 ` Xishi Qiu
2016-12-06 12:50 ` Yisheng Xie
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=20161130133358.d508cc8931be6f08ee88561f@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=acme@redhat.com \
--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 \
--cc=xieyisheng1@huawei.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
Powered by JetHome