Re: [PATCH][COMPAT] {get,set}affinity unification

Anton Blanchard (anton@samba.org)
Sat, 12 Apr 2003 03:15:06 +1000


Hi,

> +extern asmlinkage long sys_sched_getaffinity(pid_t pid, unsigned int len,
> + unsigned long *user_mask_ptr);
> +
> +asmlinkage int compat_sys_sched_getaffinity(compat_pid_t pid, unsigned int len,
> + compat_ulong_t *user_mask_ptr)
> +{
> + unsigned long kernel_mask;
> + mm_segment_t old_fs;
> + int ret;
> +
> + old_fs = get_fs();
> + set_fs(KERNEL_DS);
> + ret = sys_sched_getaffinity(pid,
> + sizeof(kernel_mask),
> + &kernel_mask);
> + set_fs(old_fs);
> +
> + if (ret == 0) {
> + if (put_user(kernel_mask, user_mask_ptr))
> + ret = -EFAULT;
> + }
> +
> + return ret;
> +}

We should really return sizeof(compat_ulong_t) here. Can you check over
the ppc64 and sparc64 versions of these, I think there are some other
problems (getaffinity returns > 0 on success but you check for 0).

Anton
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/