aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/perf_counter.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/perf_counter.c')
-rw-r--r--kernel/perf_counter.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index 20508f053658..96c333a5b0fc 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -734,26 +734,27 @@ perf_counter_alloc(u32 hw_event_period, int cpu, u32 record_type)
734 * @pid: target pid 734 * @pid: target pid
735 */ 735 */
736asmlinkage int 736asmlinkage int
737sys_perf_counter_open(u32 hw_event_type, 737sys_perf_counter_open(struct perf_counter_event __user *uevent, u32 record_type,
738 u32 hw_event_period, 738 pid_t pid, int cpu, int masterfd)
739 u32 record_type,
740 pid_t pid,
741 int cpu)
742{ 739{
743 struct perf_counter_context *ctx; 740 struct perf_counter_context *ctx;
741 struct perf_counter_event event;
744 struct perf_counter *counter; 742 struct perf_counter *counter;
745 int ret; 743 int ret;
746 744
745 if (copy_from_user(&event, uevent, sizeof(event)) != 0)
746 return -EFAULT;
747
747 ctx = find_get_context(pid, cpu); 748 ctx = find_get_context(pid, cpu);
748 if (IS_ERR(ctx)) 749 if (IS_ERR(ctx))
749 return PTR_ERR(ctx); 750 return PTR_ERR(ctx);
750 751
751 ret = -ENOMEM; 752 ret = -ENOMEM;
752 counter = perf_counter_alloc(hw_event_period, cpu, record_type); 753 counter = perf_counter_alloc(event.hw_event_period, cpu, record_type);
753 if (!counter) 754 if (!counter)
754 goto err_put_context; 755 goto err_put_context;
755 756
756 ret = hw_perf_counter_init(counter, hw_event_type); 757 ret = hw_perf_counter_init(counter, event.hw_event_type);
757 if (ret) 758 if (ret)
758 goto err_free_put_context; 759 goto err_free_put_context;
759 760