summaryrefslogtreecommitdiffstats
path: root/arch/powerpc/perf/callchain_32.c
diff options
context:
space:
mode:
authorMichal Suchanek <msuchanek@suse.de>2020-04-06 23:00:22 +0200
committerMichael Ellerman <mpe@ellerman.id.au>2020-07-30 14:53:49 +0200
commitd3a133aa0e029e0bbb67170f5f18c8fcd4701370 (patch)
treebed697e7bd70061e09d75c9ec86e7bf5961dfd27 /arch/powerpc/perf/callchain_32.c
parentpowerpc/pseries/hotplug-cpu: Remove double free in error path (diff)
downloadlinux-d3a133aa0e029e0bbb67170f5f18c8fcd4701370.tar.xz
linux-d3a133aa0e029e0bbb67170f5f18c8fcd4701370.zip
powerpc/perf: Consolidate perf_callchain_user_[64|32]()
perf_callchain_user_64() and perf_callchain_user_32() are nearly identical. Consolidate into one function with thin wrappers. Suggested-by: Nicholas Piggin <npiggin@gmail.com> Signed-off-by: Michal Suchanek <msuchanek@suse.de> [mpe: Adapt to copy_from_user_nofault(), minor formatting] Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/20200406210022.32265-1-msuchanek@suse.de
Diffstat (limited to 'arch/powerpc/perf/callchain_32.c')
-rw-r--r--arch/powerpc/perf/callchain_32.c21
1 files changed, 2 insertions, 19 deletions
diff --git a/arch/powerpc/perf/callchain_32.c b/arch/powerpc/perf/callchain_32.c
index 542e68b8eae0..64e4013d8060 100644
--- a/arch/powerpc/perf/callchain_32.c
+++ b/arch/powerpc/perf/callchain_32.c
@@ -30,26 +30,9 @@
#endif /* CONFIG_PPC64 */
-/*
- * On 32-bit we just access the address and let hash_page create a
- * HPTE if necessary, so there is no need to fall back to reading
- * the page tables. Since this is called at interrupt level,
- * do_page_fault() won't treat a DSI as a page fault.
- */
-static int read_user_stack_32(unsigned int __user *ptr, unsigned int *ret)
+static int read_user_stack_32(const unsigned int __user *ptr, unsigned int *ret)
{
- int rc;
-
- if ((unsigned long)ptr > TASK_SIZE - sizeof(unsigned int) ||
- ((unsigned long)ptr & 3))
- return -EFAULT;
-
- rc = copy_from_user_nofault(ret, ptr, sizeof(*ret));
-
- if (IS_ENABLED(CONFIG_PPC64) && rc)
- return read_user_stack_slow(ptr, ret, 4);
-
- return rc;
+ return __read_user_stack(ptr, ret, sizeof(*ret));
}
/*