Return -1 on failed modified text. Signed-off-by: Steven Rostedt --- arch/x86/kernel/ftrace.c | 12 +++++++----- kernel/trace/ftrace.c | 29 ++++++++++------------------- 2 files changed, 17 insertions(+), 24 deletions(-) Index: linux-compile.git/arch/x86/kernel/ftrace.c =================================================================== --- linux-compile.git.orig/arch/x86/kernel/ftrace.c 2008-10-22 13:10:58.000000000 -0400 +++ linux-compile.git/arch/x86/kernel/ftrace.c 2008-10-22 13:15:36.000000000 -0400 @@ -71,14 +71,16 @@ ftrace_modify_code(unsigned long ip, uns * No real locking needed, this code is run through * kstop_machine, or before SMP starts. */ - if (__copy_from_user_inatomic(replaced, (char __user *)ip, MCOUNT_INSN_SIZE)) - return 1; + if (__copy_from_user_inatomic(replaced, (char __user *)ip, + MCOUNT_INSN_SIZE)) + return -1; if (memcmp(replaced, old_code, MCOUNT_INSN_SIZE) != 0) - return 2; + return -1; - WARN_ON_ONCE(__copy_to_user_inatomic((char __user *)ip, new_code, - MCOUNT_INSN_SIZE)); + if (__copy_to_user_inatomic((char __user *)ip, new_code, + MCOUNT_INSN_SIZE)) + return -1; sync_core(); Index: linux-compile.git/kernel/trace/ftrace.c =================================================================== --- linux-compile.git.orig/kernel/trace/ftrace.c 2008-10-22 13:10:58.000000000 -0400 +++ linux-compile.git/kernel/trace/ftrace.c 2008-10-22 13:14:04.000000000 -0400 @@ -591,31 +591,22 @@ ftrace_code_disable(struct dyn_ftrace *r { unsigned long ip; unsigned char *nop, *call; - int failed; + int ret; ip = rec->ip; nop = ftrace_nop_replace(); call = ftrace_call_replace(ip, mcount_addr); - failed = ftrace_modify_code(ip, call, nop); - if (failed) { - switch (failed) { - case 1: - WARN_ON_ONCE(1); - pr_info("ftrace faulted on modifying "); - print_ip_sym(ip); - break; - case 2: - WARN_ON_ONCE(1); - pr_info("ftrace failed to modify "); - print_ip_sym(ip); - print_ip_ins(" expected: ", call); - print_ip_ins(" actual: ", (unsigned char *)ip); - print_ip_ins(" replace: ", nop); - printk(KERN_CONT "\n"); - break; - } + ret = ftrace_modify_code(ip, call, nop); + if (ret) { + WARN_ON_ONCE(1); + pr_info("ftrace failed to modify "); + print_ip_sym(ip); + print_ip_ins(" expected: ", call); + print_ip_ins(" replace: ", nop); + printk(KERN_CONT "\n"); + break; rec->flags |= FTRACE_FL_FAILED; return 0; -- -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/