Files
erofs-linux/kernel
BP, Praveen bd9b0bac6f [PATCH] sysctl: string length calculated is wrong if it contains negative numbers
In the functions do_proc_dointvec() and do_proc_doulongvec_minmax(),
there seems to be a bug in string length calculation if string contains
negative integer.

The console log given below explains the bug. Setting negative values
may not be a right thing to do for "console log level" but then the test
(given below) can be used to demonstrate the bug in the code.

# echo "-1 -1 -1 -123456" > /proc/sys/kernel/printk
# cat /proc/sys/kernel/printk
-1      -1      -1      -1234
#
# echo "-1 -1 -1 123456" > /proc/sys/kernel/printk
# cat /proc/sys/kernel/printk
-1      -1      -1      1234
#

(akpm: the bug is that 123456 gets truncated)

It works as expected if string contains all +ve integers

# echo "1 2 3 4" > /proc/sys/kernel/printk
# cat /proc/sys/kernel/printk
1       2       3       4
#

The patch given below fixes the issue.

Signed-off-by: Praveen BP <[email protected]>
Cc: "Eric W. Biederman" <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
2006-12-07 08:39:42 -08:00
..
…
…
2006-12-07 08:39:25 -08:00
2006-10-03 08:03:41 -07:00
…
2006-12-07 08:39:41 -08:00
…
…
2006-12-07 08:39:36 -08:00
…
…
2006-12-04 02:00:22 -05:00
2006-12-04 02:00:22 -05:00
…
…
…
…
2006-12-07 08:39:25 -08:00
…
2006-11-22 14:57:56 +00:00
…
…
…
…
…
…
…
…
2006-12-07 08:39:25 -08:00
…