diff options
author | Peter Zijlstra <peterz@infradead.org> | 2013-10-30 16:16:22 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2013-11-06 06:34:25 -0500 |
commit | 0a196848ca365ec582c6d86659be456be6d4ed96 (patch) | |
tree | b850a9d23a0b487d3e0e6c72b0974569796edf56 /arch | |
parent | 394570b7939e1262f39373866166d8ee0a506e88 (diff) |
perf: Fix arch_perf_out_copy_user default
The arch_perf_output_copy_user() default of
__copy_from_user_inatomic() returns bytes not copied, while all other
argument functions given DEFINE_OUTPUT_COPY() return bytes copied.
Since copy_from_user_nmi() is the odd duck out by returning bytes
copied where all other *copy_{to,from}* functions return bytes not
copied, change it over and ammend DEFINE_OUTPUT_COPY() to expect bytes
not copied.
Oddly enough DEFINE_OUTPUT_COPY() already returned bytes not copied
while expecting its worker functions to return bytes copied.
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Acked-by: will.deacon@arm.com
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Link: http://lkml.kernel.org/r/20131030201622.GR16117@laptop.programming.kicks-ass.net
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/kernel/cpu/perf_event.c | 4 | ||||
-rw-r--r-- | arch/x86/kernel/cpu/perf_event_intel_ds.c | 2 | ||||
-rw-r--r-- | arch/x86/kernel/cpu/perf_event_intel_lbr.c | 2 | ||||
-rw-r--r-- | arch/x86/lib/usercopy.c | 2 | ||||
-rw-r--r-- | arch/x86/oprofile/backtrace.c | 4 |
5 files changed, 7 insertions, 7 deletions
diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c index 8a87a3224121..8e132931614d 100644 --- a/arch/x86/kernel/cpu/perf_event.c +++ b/arch/x86/kernel/cpu/perf_event.c | |||
@@ -1989,7 +1989,7 @@ perf_callchain_user32(struct pt_regs *regs, struct perf_callchain_entry *entry) | |||
1989 | frame.return_address = 0; | 1989 | frame.return_address = 0; |
1990 | 1990 | ||
1991 | bytes = copy_from_user_nmi(&frame, fp, sizeof(frame)); | 1991 | bytes = copy_from_user_nmi(&frame, fp, sizeof(frame)); |
1992 | if (bytes != sizeof(frame)) | 1992 | if (bytes != 0) |
1993 | break; | 1993 | break; |
1994 | 1994 | ||
1995 | if (!valid_user_frame(fp, sizeof(frame))) | 1995 | if (!valid_user_frame(fp, sizeof(frame))) |
@@ -2041,7 +2041,7 @@ perf_callchain_user(struct perf_callchain_entry *entry, struct pt_regs *regs) | |||
2041 | frame.return_address = 0; | 2041 | frame.return_address = 0; |
2042 | 2042 | ||
2043 | bytes = copy_from_user_nmi(&frame, fp, sizeof(frame)); | 2043 | bytes = copy_from_user_nmi(&frame, fp, sizeof(frame)); |
2044 | if (bytes != sizeof(frame)) | 2044 | if (bytes != 0) |
2045 | break; | 2045 | break; |
2046 | 2046 | ||
2047 | if (!valid_user_frame(fp, sizeof(frame))) | 2047 | if (!valid_user_frame(fp, sizeof(frame))) |
diff --git a/arch/x86/kernel/cpu/perf_event_intel_ds.c b/arch/x86/kernel/cpu/perf_event_intel_ds.c index c1760ff3c757..ae96cfa5eddd 100644 --- a/arch/x86/kernel/cpu/perf_event_intel_ds.c +++ b/arch/x86/kernel/cpu/perf_event_intel_ds.c | |||
@@ -789,7 +789,7 @@ static int intel_pmu_pebs_fixup_ip(struct pt_regs *regs) | |||
789 | 789 | ||
790 | size = ip - to; /* Must fit our buffer, see above */ | 790 | size = ip - to; /* Must fit our buffer, see above */ |
791 | bytes = copy_from_user_nmi(buf, (void __user *)to, size); | 791 | bytes = copy_from_user_nmi(buf, (void __user *)to, size); |
792 | if (bytes != size) | 792 | if (bytes != 0) |
793 | return 0; | 793 | return 0; |
794 | 794 | ||
795 | kaddr = buf; | 795 | kaddr = buf; |
diff --git a/arch/x86/kernel/cpu/perf_event_intel_lbr.c b/arch/x86/kernel/cpu/perf_event_intel_lbr.c index 90ee6c1d0542..d82d155aca8c 100644 --- a/arch/x86/kernel/cpu/perf_event_intel_lbr.c +++ b/arch/x86/kernel/cpu/perf_event_intel_lbr.c | |||
@@ -491,7 +491,7 @@ static int branch_type(unsigned long from, unsigned long to, int abort) | |||
491 | 491 | ||
492 | /* may fail if text not present */ | 492 | /* may fail if text not present */ |
493 | bytes = copy_from_user_nmi(buf, (void __user *)from, size); | 493 | bytes = copy_from_user_nmi(buf, (void __user *)from, size); |
494 | if (bytes != size) | 494 | if (bytes != 0) |
495 | return X86_BR_NONE; | 495 | return X86_BR_NONE; |
496 | 496 | ||
497 | addr = buf; | 497 | addr = buf; |
diff --git a/arch/x86/lib/usercopy.c b/arch/x86/lib/usercopy.c index 5465b8613944..ddf9ecb53cc3 100644 --- a/arch/x86/lib/usercopy.c +++ b/arch/x86/lib/usercopy.c | |||
@@ -31,6 +31,6 @@ copy_from_user_nmi(void *to, const void __user *from, unsigned long n) | |||
31 | ret = __copy_from_user_inatomic(to, from, n); | 31 | ret = __copy_from_user_inatomic(to, from, n); |
32 | pagefault_enable(); | 32 | pagefault_enable(); |
33 | 33 | ||
34 | return n - ret; | 34 | return ret; |
35 | } | 35 | } |
36 | EXPORT_SYMBOL_GPL(copy_from_user_nmi); | 36 | EXPORT_SYMBOL_GPL(copy_from_user_nmi); |
diff --git a/arch/x86/oprofile/backtrace.c b/arch/x86/oprofile/backtrace.c index d6aa6e8315d1..5d04be5efb64 100644 --- a/arch/x86/oprofile/backtrace.c +++ b/arch/x86/oprofile/backtrace.c | |||
@@ -47,7 +47,7 @@ dump_user_backtrace_32(struct stack_frame_ia32 *head) | |||
47 | unsigned long bytes; | 47 | unsigned long bytes; |
48 | 48 | ||
49 | bytes = copy_from_user_nmi(bufhead, head, sizeof(bufhead)); | 49 | bytes = copy_from_user_nmi(bufhead, head, sizeof(bufhead)); |
50 | if (bytes != sizeof(bufhead)) | 50 | if (bytes != 0) |
51 | return NULL; | 51 | return NULL; |
52 | 52 | ||
53 | fp = (struct stack_frame_ia32 *) compat_ptr(bufhead[0].next_frame); | 53 | fp = (struct stack_frame_ia32 *) compat_ptr(bufhead[0].next_frame); |
@@ -93,7 +93,7 @@ static struct stack_frame *dump_user_backtrace(struct stack_frame *head) | |||
93 | unsigned long bytes; | 93 | unsigned long bytes; |
94 | 94 | ||
95 | bytes = copy_from_user_nmi(bufhead, head, sizeof(bufhead)); | 95 | bytes = copy_from_user_nmi(bufhead, head, sizeof(bufhead)); |
96 | if (bytes != sizeof(bufhead)) | 96 | if (bytes != 0) |
97 | return NULL; | 97 | return NULL; |
98 | 98 | ||
99 | oprofile_add_trace(bufhead[0].return_address); | 99 | oprofile_add_trace(bufhead[0].return_address); |