Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 191963
b: refs/heads/master
c: fa9dc26
h: refs/heads/master
i:
  191961: aa872fd
  191959: 4cb58c2
v: v3
  • Loading branch information
KOSAKI Motohiro authored and Linus Torvalds committed May 19, 2010
1 parent 6f16c9a commit 548bf91
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 15 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: cf77e988ddfc7f047ac1ddc72cadb5eee7e09293
refs/heads/master: fa9dc265ace9774e62f0e31108e5f47911124bda
25 changes: 11 additions & 14 deletions trunk/kernel/compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -495,29 +495,26 @@ asmlinkage long compat_sys_sched_getaffinity(compat_pid_t pid, unsigned int len,
{
int ret;
cpumask_var_t mask;
unsigned long *k;
unsigned int min_length = cpumask_size();

if (nr_cpu_ids <= BITS_PER_COMPAT_LONG)
min_length = sizeof(compat_ulong_t);

if (len < min_length)
if ((len * BITS_PER_BYTE) < nr_cpu_ids)
return -EINVAL;
if (len & (sizeof(compat_ulong_t)-1))
return -EINVAL;

if (!alloc_cpumask_var(&mask, GFP_KERNEL))
return -ENOMEM;

ret = sched_getaffinity(pid, mask);
if (ret < 0)
goto out;
if (ret == 0) {
size_t retlen = min_t(size_t, len, cpumask_size());

k = cpumask_bits(mask);
ret = compat_put_bitmap(user_mask_ptr, k, min_length * 8);
if (ret == 0)
ret = min_length;

out:
if (compat_put_bitmap(user_mask_ptr, cpumask_bits(mask), retlen * 8))
ret = -EFAULT;
else
ret = retlen;
}
free_cpumask_var(mask);

return ret;
}

Expand Down

0 comments on commit 548bf91

Please sign in to comment.