Re: cciss update for 2.6.7-rc1

From: viro
Date: Fri Jun 04 2004 - 16:01:14 EST


On Wed, Jun 02, 2004 at 03:13:26PM -0500, mikem@xxxxxxxxxxxxxxxxxxxxxxx wrote:

a) use compat_alloc_user_space() and copy_in_user()

> + err |= copy_from_user(&arg64.LUN_info, &arg32->LUN_info, sizeof(arg64.LUN_info));
> + err |= copy_from_user(&arg64.Request, &arg32->Request, sizeof(arg64.Request));
> + err |= copy_from_user(&arg64.error_info, &arg32->error_info, sizeof(arg64.error_info));
> + err |= get_user(arg64.buf_size, &arg32->buf_size);

b) use compat_ptr() to convert pointers

> + err |= get_user(arg64.buf, &arg32->buf);


c) and do not bother with get_fs()/set_fs() at all - with
compat_alloc_user_space() variant you won't need it.

> + old_fs = get_fs();
> + set_fs(KERNEL_DS);
> + err = sys_ioctl(fd, CCISS_PASSTHRU, (unsigned long) &arg64);
> + set_fs(old_fs);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/