Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1533590
| From | Andrew Morton <akpm@linux-foundation.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] kernel/sysctl: return -EINVAL if write invalid val to ulong type sysctl |
| Date | 2016-11-30 22:40 +0100 |
| Message-ID | <sJkLD-2XW-7@gated-at.bofh.it> (permalink) |
| References | <sJasW-4VL-9@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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?
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH] kernel/sysctl: return -EINVAL if write invalid val to ulong type sysctl Yisheng Xie <xieyisheng1@huawei.com> - 2016-11-30 11:40 +0100
Re: [PATCH] kernel/sysctl: return -EINVAL if write invalid val to ulong type sysctl Andrew Morton <akpm@linux-foundation.org> - 2016-11-30 22:40 +0100
Re: [PATCH] kernel/sysctl: return -EINVAL if write invalid val to ulong type sysctl Yisheng Xie <xieyisheng1@huawei.com> - 2016-12-02 08:00 +0100
Re: [PATCH] kernel/sysctl: return -EINVAL if write invalid val to ulong type sysctl ebiederm@xmission.com (Eric W. Biederman) - 2016-12-02 20:30 +0100
Re: [PATCH] kernel/sysctl: return -EINVAL if write invalid val to ulong type sysctl Xishi Qiu <qiuxishi@huawei.com> - 2016-12-05 07:20 +0100
Re: [PATCH] kernel/sysctl: return -EINVAL if write invalid val to ulong type sysctl Yisheng Xie <xieyisheng1@huawei.com> - 2016-12-06 14:00 +0100
csiph-web