aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/ftrace.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/kernel/ftrace.c')
-rw-r--r--arch/x86/kernel/ftrace.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/arch/x86/kernel/ftrace.c b/arch/x86/kernel/ftrace.c
index 8821ceabf51d..428291581cb2 100644
--- a/arch/x86/kernel/ftrace.c
+++ b/arch/x86/kernel/ftrace.c
@@ -62,7 +62,6 @@ ftrace_modify_code(unsigned long ip, unsigned char *old_code,
62 unsigned char *new_code) 62 unsigned char *new_code)
63{ 63{
64 unsigned char replaced[MCOUNT_INSN_SIZE]; 64 unsigned char replaced[MCOUNT_INSN_SIZE];
65 int ret;
66 65
67 /* 66 /*
68 * Note: Due to modules and __init, code can 67 * Note: Due to modules and __init, code can
@@ -72,15 +71,16 @@ ftrace_modify_code(unsigned long ip, unsigned char *old_code,
72 * No real locking needed, this code is run through 71 * No real locking needed, this code is run through
73 * kstop_machine, or before SMP starts. 72 * kstop_machine, or before SMP starts.
74 */ 73 */
75 if (__copy_from_user_inatomic(replaced, (char __user *)ip, MCOUNT_INSN_SIZE)) 74 if (__copy_from_user_inatomic(replaced, (char __user *)ip,
76 return 1; 75 MCOUNT_INSN_SIZE))
76 return -EFAULT;
77 77
78 if (memcmp(replaced, old_code, MCOUNT_INSN_SIZE) != 0) 78 if (memcmp(replaced, old_code, MCOUNT_INSN_SIZE) != 0)
79 return 2; 79 return -EINVAL;
80 80
81 ret = __copy_to_user_inatomic((char __user *)ip, new_code, 81 if (__copy_to_user_inatomic((char __user *)ip, new_code,
82 MCOUNT_INSN_SIZE); 82 MCOUNT_INSN_SIZE))
83 WARN_ON_ONCE(ret); 83 return -EPERM;
84 84
85 sync_core(); 85 sync_core();
86 86