All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] unicore32: fix framepointer check in unwind_frame
@ 2019-05-28 12:04 Young Xiao
  0 siblings, 0 replies; only message in thread
From: Young Xiao @ 2019-05-28 12:04 UTC (permalink / raw)
  To: gxt, peterz, tglx, linux-kernel; +Cc: Young Xiao

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").

Signed-off-by: Young Xiao <92siuyang@gmail.com>
---
 arch/unicore32/kernel/stacktrace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/unicore32/kernel/stacktrace.c b/arch/unicore32/kernel/stacktrace.c
index e37da8c..8e5d12e 100644
--- a/arch/unicore32/kernel/stacktrace.c
+++ b/arch/unicore32/kernel/stacktrace.c
@@ -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 */
-- 
2.7.4


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2019-05-28 12:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-28 12:04 [PATCH] unicore32: fix framepointer check in unwind_frame Young Xiao

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.