aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/sched.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2010-04-02 13:37:50 -0400
committerIngo Molnar <mingo@elte.hu>2010-04-02 13:38:10 -0400
commitec5e61aabeac58670691bd0613388d16697d0d81 (patch)
tree59838509358f27334874b90756505785cde29b02 /kernel/sched.c
parent75ec5a245c7763c397f31ec8964d0a46c54a7386 (diff)
parent8bb39f9aa068262732fe44b965d7a6eb5a5a7d67 (diff)
Merge branch 'perf/urgent' into perf/core
Conflicts: arch/x86/kernel/cpu/perf_event.c Merge reason: Resolve the conflict, pick up fixes Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/sched.c')
-rw-r--r--kernel/sched.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/kernel/sched.c b/kernel/sched.c
index 117b7cad31b3..1038ca163890 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -2607,7 +2607,7 @@ void wake_up_new_task(struct task_struct *p, unsigned long clone_flags)
2607{ 2607{
2608 unsigned long flags; 2608 unsigned long flags;
2609 struct rq *rq; 2609 struct rq *rq;
2610 int cpu = get_cpu(); 2610 int cpu __maybe_unused = get_cpu();
2611 2611
2612#ifdef CONFIG_SMP 2612#ifdef CONFIG_SMP
2613 /* 2613 /*
@@ -4859,7 +4859,9 @@ SYSCALL_DEFINE3(sched_getaffinity, pid_t, pid, unsigned int, len,
4859 int ret; 4859 int ret;
4860 cpumask_var_t mask; 4860 cpumask_var_t mask;
4861 4861
4862 if (len < cpumask_size()) 4862 if (len < nr_cpu_ids)
4863 return -EINVAL;
4864 if (len & (sizeof(unsigned long)-1))
4863 return -EINVAL; 4865 return -EINVAL;
4864 4866
4865 if (!alloc_cpumask_var(&mask, GFP_KERNEL)) 4867 if (!alloc_cpumask_var(&mask, GFP_KERNEL))
@@ -4867,10 +4869,12 @@ SYSCALL_DEFINE3(sched_getaffinity, pid_t, pid, unsigned int, len,
4867 4869
4868 ret = sched_getaffinity(pid, mask); 4870 ret = sched_getaffinity(pid, mask);
4869 if (ret == 0) { 4871 if (ret == 0) {
4870 if (copy_to_user(user_mask_ptr, mask, cpumask_size())) 4872 size_t retlen = min_t(size_t, len, cpumask_size());
4873
4874 if (copy_to_user(user_mask_ptr, mask, retlen))
4871 ret = -EFAULT; 4875 ret = -EFAULT;
4872 else 4876 else
4873 ret = cpumask_size(); 4877 ret = retlen;
4874 } 4878 }
4875 free_cpumask_var(mask); 4879 free_cpumask_var(mask);
4876 4880