Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 125322
b: refs/heads/master
c: f17c860
h: refs/heads/master
v: v3
  • Loading branch information
Rusty Russell authored and Ingo Molnar committed Nov 24, 2008
1 parent 4800c72 commit 2155ab0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a0e902452da16b79d7c9230630ed8a595d14fa85
refs/heads/master: f17c860760927c2a8e41a021eab3317e4415e962
21 changes: 13 additions & 8 deletions trunk/kernel/sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -5499,19 +5499,24 @@ asmlinkage long sys_sched_getaffinity(pid_t pid, unsigned int len,
unsigned long __user *user_mask_ptr)
{
int ret;
cpumask_t mask;
cpumask_var_t mask;

if (len < sizeof(cpumask_t))
if (len < cpumask_size())
return -EINVAL;

ret = sched_getaffinity(pid, &mask);
if (ret < 0)
return ret;
if (!alloc_cpumask_var(&mask, GFP_KERNEL))
return -ENOMEM;

if (copy_to_user(user_mask_ptr, &mask, sizeof(cpumask_t)))
return -EFAULT;
ret = sched_getaffinity(pid, mask);
if (ret == 0) {
if (copy_to_user(user_mask_ptr, mask, cpumask_size()))
ret = -EFAULT;
else
ret = cpumask_size();
}
free_cpumask_var(mask);

return sizeof(cpumask_t);
return ret;
}

/**
Expand Down

0 comments on commit 2155ab0

Please sign in to comment.