[ARM] Fix stacktrace FP range checking
authorRussell King <rmk@dyn-67.arm.linux.org.uk>
Sat, 26 May 2007 11:04:17 +0000 (12:04 +0100)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Wed, 30 May 2007 12:15:12 +0000 (13:15 +0100)
Fix an oops in the stacktrace code, caused by improper range checking.
We subtract 12 off 'fp' before testing to see if it's below the low
bound.  However, if 'fp' were zero before, it becomes a very large
positive number, causing this test to succeed where it should fail.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
arch/arm/kernel/stacktrace.c

index 8b63ad89d0a815c2cde57f138b951bffba33471a..ae31deb2d0653a6a8fe57b000fb2827de9acdf13 100644 (file)
@@ -13,7 +13,7 @@ int walk_stackframe(unsigned long fp, unsigned long low, unsigned long high,
                /*
                 * Check current frame pointer is within bounds
                 */
-               if ((fp - 12) < low || fp + 4 >= high)
+               if (fp < (low + 12) || fp + 4 >= high)
                        break;
 
                frame = (struct stackframe *)(fp - 12);