aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/powerpc/oprofile/backtrace.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/arch/powerpc/oprofile/backtrace.c b/arch/powerpc/oprofile/backtrace.c
index 75f57bc96b40..b4278cfd1f80 100644
--- a/arch/powerpc/oprofile/backtrace.c
+++ b/arch/powerpc/oprofile/backtrace.c
@@ -11,6 +11,7 @@
11#include <linux/sched.h> 11#include <linux/sched.h>
12#include <asm/processor.h> 12#include <asm/processor.h>
13#include <asm/uaccess.h> 13#include <asm/uaccess.h>
14#include <asm/compat.h>
14 15
15#define STACK_SP(STACK) *(STACK) 16#define STACK_SP(STACK) *(STACK)
16 17
@@ -26,8 +27,9 @@
26static unsigned int user_getsp32(unsigned int sp, int is_first) 27static unsigned int user_getsp32(unsigned int sp, int is_first)
27{ 28{
28 unsigned int stack_frame[2]; 29 unsigned int stack_frame[2];
30 void __user *p = compat_ptr(sp);
29 31
30 if (!access_ok(VERIFY_READ, sp, sizeof(stack_frame))) 32 if (!access_ok(VERIFY_READ, p, sizeof(stack_frame)))
31 return 0; 33 return 0;
32 34
33 /* 35 /*
@@ -35,8 +37,7 @@ static unsigned int user_getsp32(unsigned int sp, int is_first)
35 * which means that we've done all that we can do from 37 * which means that we've done all that we can do from
36 * interrupt context. 38 * interrupt context.
37 */ 39 */
38 if (__copy_from_user_inatomic(stack_frame, (void *)(long)sp, 40 if (__copy_from_user_inatomic(stack_frame, p, sizeof(stack_frame)))
39 sizeof(stack_frame)))
40 return 0; 41 return 0;
41 42
42 if (!is_first) 43 if (!is_first)
@@ -54,10 +55,10 @@ static unsigned long user_getsp64(unsigned long sp, int is_first)
54{ 55{
55 unsigned long stack_frame[3]; 56 unsigned long stack_frame[3];
56 57
57 if (!access_ok(VERIFY_READ, sp, sizeof(stack_frame))) 58 if (!access_ok(VERIFY_READ, (void __user *)sp, sizeof(stack_frame)))
58 return 0; 59 return 0;
59 60
60 if (__copy_from_user_inatomic(stack_frame, (void *)sp, 61 if (__copy_from_user_inatomic(stack_frame, (void __user *)sp,
61 sizeof(stack_frame))) 62 sizeof(stack_frame)))
62 return 0; 63 return 0;
63 64