[patch] net: get rid of redundant access_ok() call in checksumcalculation.

From: Jesper Juhl
Date: Thu Jan 06 2005 - 18:33:25 EST



Hi,

in include/net/checksum.h::csum_and_copy_to_user it would seem that the
access_ok() call before attempting to call copy_to_user() is redundant
since copy_to_user() calls access_ok() internally.

If that is indeed the case then please consider applying the patch below
(if that access_ok() does make sense I'd apreciate to be told why).


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

diff -up linux-2.6.10-bk9-orig/include/net/checksum.h linux-2.6.10-bk9/include/net/checksum.h
--- linux-2.6.10-bk9-orig/include/net/checksum.h 2004-12-24 22:34:26.000000000 +0100
+++ linux-2.6.10-bk9/include/net/checksum.h 2005-01-07 00:27:05.000000000 +0100
@@ -46,10 +46,9 @@ static __inline__ unsigned int csum_and_
{
sum = csum_partial(src, len, sum);

- if (access_ok(VERIFY_WRITE, dst, len)) {
- if (copy_to_user(dst, src, len) == 0)
- return sum;
- }
+ if (copy_to_user(dst, src, len) == 0)
+ return sum;
+
if (len)
*err_ptr = -EFAULT;




-
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/