The patch titled
     sysctl: string length calculated is wrong if it contains negative numbers
has been added to the -mm tree.  Its filename is
     
sysctl-string-length-calculated-is-wrong-if-it-contains-negative-numbers.patch

See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find
out what to do about this

------------------------------------------------------
Subject: sysctl: string length calculated is wrong if it contains negative 
numbers
From: "BP, Praveen" <[EMAIL PROTECTED]>

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]>
---

 kernel/sysctl.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff -puN 
kernel/sysctl.c~sysctl-string-length-calculated-is-wrong-if-it-contains-negative-numbers
 kernel/sysctl.c
--- 
a/kernel/sysctl.c~sysctl-string-length-calculated-is-wrong-if-it-contains-negative-numbers
+++ a/kernel/sysctl.c
@@ -1886,7 +1886,7 @@ static int __do_proc_dointvec(void *tbl_
                        p = buf;
                        if (*p == '-' && left > 1) {
                                neg = 1;
-                               left--, p++;
+                               p++;
                        }
                        if (*p < '0' || *p > '9')
                                break;
@@ -2137,7 +2137,7 @@ static int __do_proc_doulongvec_minmax(v
                        p = buf;
                        if (*p == '-' && left > 1) {
                                neg = 1;
-                               left--, p++;
+                               p++;
                        }
                        if (*p < '0' || *p > '9')
                                break;
_

Patches currently in -mm which might be from [EMAIL PROTECTED] are

sysctl-string-length-calculated-is-wrong-if-it-contains-negative-numbers.patch

-
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to