Re: [PATCH][3/4] let's kill verify_area - convert kernel/compat.c to access_ok()

From: Andries Brouwer
Date: Thu Jan 06 2005 - 21:03:06 EST


On Fri, Jan 07, 2005 at 02:18:44AM +0100, Jesper Juhl wrote:

> Here's a patch to convert verify_area to access_ok in kernel/compat.c
>
> diff -up linux-2.6.10-bk9-orig/kernel/compat.c linux-2.6.10-bk9/kernel/compat.c
> --- linux-2.6.10-bk9-orig/kernel/compat.c 2005-01-06 22:19:13.000000000 +0100
> +++ linux-2.6.10-bk9/kernel/compat.c 2005-01-07 02:06:00.000000000 +0100
> @@ -26,16 +26,16 @@
>
> int get_compat_timespec(struct timespec *ts, const struct compat_timespec __user *cts)
> {
> - return (verify_area(VERIFY_READ, cts, sizeof(*cts)) ||
> + return (access_ok(VERIFY_READ, cts, sizeof(*cts)) ||
> __get_user(ts->tv_sec, &cts->tv_sec) ||
> - __get_user(ts->tv_nsec, &cts->tv_nsec)) ? -EFAULT : 0;
> + __get_user(ts->tv_nsec, &cts->tv_nsec)) ? 0 : -EFAULT;
> }

This is not an equivalent transformation.
-
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/