]> err.no Git - linux-2.6/commit
[PATCH] sysctl_{,ms_}jiffies: fix oldlen semantics
authorAlexey Dobriyan <adobriyan@openvz.org>
Sat, 10 Feb 2007 09:44:39 +0000 (01:44 -0800)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Sun, 11 Feb 2007 18:51:24 +0000 (10:51 -0800)
commit3ee75ac3c0f4904633322b7d9b111566fbc4a7d3
tree2456021d63e95e92ce6bfae2e1f9d83c1843319d
parent8b6312f4dcc1efe7975731b6c47dd134282bd9ac
[PATCH] sysctl_{,ms_}jiffies: fix oldlen semantics

currently it's
1) if *oldlenp == 0,
don't writeback anything

2) if *oldlenp >= table->maxlen,
don't writeback more than table->maxlen bytes and rewrite *oldlenp
don't look at underlying type granularity

3) if 0 < *oldlenp < table->maxlen,
*cough*
string sysctls don't writeback more than *oldlenp bytes.
OK, that's because sizeof(char) == 1

int sysctls writeback anything in (0, table->maxlen] range
Though accept integers divisible by sizeof(int) for writing.

sysctl_jiffies and sysctl_ms_jiffies don't writeback anything but
sizeof(int), which violates 1) and 2).

So, make sysctl_jiffies and sysctl_ms_jiffies accept
a) *oldlenp == 0, not doing writeback
b) *oldlenp >= sizeof(int), writing one integer.

-EINVAL still returned for *oldlenp == 1, 2, 3.

Signed-off-by: Alexey Dobriyan <adobriyan@openvz.org>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
kernel/sysctl.c