Skip to contentSkip to conversation

unicore32: fix framepointer check in unwind_frame

PATCH New Young Xiao 1 participant 1 message May 28, 2019

lore
Share & tools
lore

Young Xiao

author
#0 lore raw

PATCH 1/1 unicore32: fix framepointer check in unwind_frame

This patch fixes corner case when (fp + 4) overflows unsigned long, for example: fp = 0xFFFFFFFF -> fp + 4 == 3.

Copy from commit 3abb6671a9c0 ("ARM: 7913/1: fix framepointer check in unwind_frame").

---
 arch/unicore32/kernel/stacktrace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/unicore32/kernel/stacktrace.c +1 -1
index e37da8c..8e5d12e 100644
@@ -43,7 +43,7 @@ int notrace unwind_frame(struct stackframe *frame)
 	high = ALIGN(low, THREAD_SIZE);
 
 	/* check current frame pointer is within bounds */
-	if (fp < (low + 12) || fp + 4 >= high)
+	if (fp < low + 12 || fp > high - 4)
 		return -EINVAL;
 
 	/* restore the registers from the stack frame */
Signature · 1 line
2.7.4