| To: | linux-kernel <linux-kernel@xxxxxxxxxxxxxxx> |
|---|---|
| Subject: | [patch] net: get rid of redundant access_ok() call in checksum calculation. |
| From: | Jesper Juhl <juhl-lkml@xxxxxx> |
| Date: | Fri, 7 Jan 2005 00:35:24 +0100 (CET) |
| Cc: | linux-net@xxxxxxxxxxxxxxx, netdev@xxxxxxxxxxx, Jorge Cwik <jorge@xxxxxxxxxxxxxxxxx>, Arnt Gulbrandsen <agulbra@xxxxxxxxxxx> |
| Sender: | netdev-bounce@xxxxxxxxxxx |
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;
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | Re: TG3 fix for slow switches (Was: TG3 driver failure on HP 16-way), David S. Miller |
|---|---|
| Next by Date: | [PATCH 3/28] net/airo: replace schedule_timeout() with msleep()/ssleep(), Nishanth Aravamudan |
| Previous by Thread: | Re: TG3 fix for slow switches (Was: TG3 driver failure on HP 16-way), David S. Miller |
| Next by Thread: | [PATCH 3/28] net/airo: replace schedule_timeout() with msleep()/ssleep(), Nishanth Aravamudan |
| Indexes: | [Date] [Thread] [Top] [All Lists] |