[PATCH] kill access_ok() call from copy_siginfo_to_user() that wemight as well avoid.

From: Jesper Juhl
Date: Mon Dec 20 2004 - 18:29:13 EST


In kernel/signal.c::copy_siginfo_to_user() we are calling access_ok()
unconditionally. As I see it there's no need for this since we might as
well just call copy_to_user() instead of __copy_to_user() later on and
then only get the overhead of the access_ok() check (inside
copy_to_user()) when the if (from->si_code < 0) branch is actually taken.
In the case where the branch is taken the cost is the same, but when the
branch is not taken this patch will save us an access_ok() call.

Comments are always welcome.

Signed-off-by: Jesper Juhl <juhl-lkml@xxxxxx>

diff -up linux-2.6.10-rc3-bk13-orig/kernel/signal.c linux-2.6.10-rc3-bk13/kernel/signal.c
--- linux-2.6.10-rc3-bk13-orig/kernel/signal.c 2004-12-06 22:24:56.000000000 +0100
+++ linux-2.6.10-rc3-bk13/kernel/signal.c 2004-12-21 00:23:46.000000000 +0100
@@ -2070,10 +2070,8 @@ int copy_siginfo_to_user(siginfo_t __use
int err;

- if (!access_ok (VERIFY_WRITE, to, sizeof(siginfo_t)))
- return -EFAULT;
if (from->si_code < 0)
- return __copy_to_user(to, from, sizeof(siginfo_t))
+ return copy_to_user(to, from, sizeof(siginfo_t))
? -EFAULT : 0;
* If you change siginfo_t structure, please be sure

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/