lkml.org 
[lkml]   [2005]   [Jan]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[patch] net: get rid of redundant access_ok() call in checksum calculation.

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@dif.dk>

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@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 14:09    [W:0.035 / U:1.120 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site