hc
2024-05-10 23fa18eaa71266feff7ba8d83022d9e1cc83c65a
kernel/arch/powerpc/oprofile/backtrace.c
....@@ -1,18 +1,15 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /**
23 * Copyright (C) 2005 Brian Rogan <bcr6@cornell.edu>, IBM
34 *
4
- * This program is free software; you can redistribute it and/or
5
- * modify it under the terms of the GNU General Public License
6
- * as published by the Free Software Foundation; either version
7
- * 2 of the License, or (at your option) any later version.
85 **/
96
10
-#include <linux/compat_time.h>
7
+#include <linux/time.h>
118 #include <linux/oprofile.h>
129 #include <linux/sched.h>
1310 #include <asm/processor.h>
1411 #include <linux/uaccess.h>
15
-#include <asm/compat.h>
12
+#include <linux/compat.h>
1613 #include <asm/oprofile_impl.h>
1714
1815 #define STACK_SP(STACK) *(STACK)
....@@ -31,15 +28,13 @@
3128 unsigned int stack_frame[2];
3229 void __user *p = compat_ptr(sp);
3330
34
- if (!access_ok(VERIFY_READ, p, sizeof(stack_frame)))
35
- return 0;
36
-
3731 /*
3832 * The most likely reason for this is that we returned -EFAULT,
3933 * which means that we've done all that we can do from
4034 * interrupt context.
4135 */
42
- if (__copy_from_user_inatomic(stack_frame, p, sizeof(stack_frame)))
36
+ if (copy_from_user_nofault(stack_frame, (void __user *)p,
37
+ sizeof(stack_frame)))
4338 return 0;
4439
4540 if (!is_first)
....@@ -57,11 +52,8 @@
5752 {
5853 unsigned long stack_frame[3];
5954
60
- if (!access_ok(VERIFY_READ, (void __user *)sp, sizeof(stack_frame)))
61
- return 0;
62
-
63
- if (__copy_from_user_inatomic(stack_frame, (void __user *)sp,
64
- sizeof(stack_frame)))
55
+ if (copy_from_user_nofault(stack_frame, (void __user *)sp,
56
+ sizeof(stack_frame)))
6557 return 0;
6658
6759 if (!is_first)
....@@ -106,7 +98,6 @@
10698 first_frame = 0;
10799 }
108100 } else {
109
- pagefault_disable();
110101 #ifdef CONFIG_PPC64
111102 if (!is_32bit_task()) {
112103 while (depth--) {
....@@ -115,7 +106,6 @@
115106 break;
116107 first_frame = 0;
117108 }
118
- pagefault_enable();
119109 return;
120110 }
121111 #endif
....@@ -126,6 +116,5 @@
126116 break;
127117 first_frame = 0;
128118 }
129
- pagefault_enable();
130119 }
131120 }