Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0a196848 authored by Peter Zijlstra's avatar Peter Zijlstra Committed by Ingo Molnar
Browse files

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: default avatarPeter Zijlstra <peterz@infradead.org>
Acked-by: default avatar <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: default avatarIngo Molnar <mingo@kernel.org>
parent 394570b7
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -1989,7 +1989,7 @@ perf_callchain_user32(struct pt_regs *regs, struct perf_callchain_entry *entry)
		frame.return_address = 0;

		bytes = copy_from_user_nmi(&frame, fp, sizeof(frame));
		if (bytes != sizeof(frame))
		if (bytes != 0)
			break;

		if (!valid_user_frame(fp, sizeof(frame)))
@@ -2041,7 +2041,7 @@ perf_callchain_user(struct perf_callchain_entry *entry, struct pt_regs *regs)
		frame.return_address = 0;

		bytes = copy_from_user_nmi(&frame, fp, sizeof(frame));
		if (bytes != sizeof(frame))
		if (bytes != 0)
			break;

		if (!valid_user_frame(fp, sizeof(frame)))
+1 −1
Original line number Diff line number Diff line
@@ -789,7 +789,7 @@ static int intel_pmu_pebs_fixup_ip(struct pt_regs *regs)

		size = ip - to; /* Must fit our buffer, see above */
		bytes = copy_from_user_nmi(buf, (void __user *)to, size);
		if (bytes != size)
		if (bytes != 0)
			return 0;

		kaddr = buf;
+1 −1
Original line number Diff line number Diff line
@@ -491,7 +491,7 @@ static int branch_type(unsigned long from, unsigned long to, int abort)

		/* may fail if text not present */
		bytes = copy_from_user_nmi(buf, (void __user *)from, size);
		if (bytes != size)
		if (bytes != 0)
			return X86_BR_NONE;

		addr = buf;
+1 −1
Original line number Diff line number Diff line
@@ -31,6 +31,6 @@ copy_from_user_nmi(void *to, const void __user *from, unsigned long n)
	ret = __copy_from_user_inatomic(to, from, n);
	pagefault_enable();

	return n - ret;
	return ret;
}
EXPORT_SYMBOL_GPL(copy_from_user_nmi);
+2 −2
Original line number Diff line number Diff line
@@ -47,7 +47,7 @@ dump_user_backtrace_32(struct stack_frame_ia32 *head)
	unsigned long bytes;

	bytes = copy_from_user_nmi(bufhead, head, sizeof(bufhead));
	if (bytes != sizeof(bufhead))
	if (bytes != 0)
		return NULL;

	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)
	unsigned long bytes;

	bytes = copy_from_user_nmi(bufhead, head, sizeof(bufhead));
	if (bytes != sizeof(bufhead))
	if (bytes != 0)
		return NULL;

	oprofile_add_trace(bufhead[0].return_address);
Loading