mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jesper Juhl <juhl-lkml@dif.dk>
To: linux-kernel <linux-kernel@vger.kernel.org>
Cc: linux-net@vger.kernel.org, netdev@oss.sgi.com,
	Jorge Cwik <jorge@laser.satlink.net>,
	Arnt Gulbrandsen <agulbra@nvg.unit.no>
Subject: [patch] net: get rid of redundant access_ok() call in checksum calculation.
Date: Fri, 7 Jan 2005 00:35:24 +0100 (CET)	[thread overview]
Message-ID: <Pine.LNX.4.61.0501070028010.3430@dragon.hygekrogen.localhost> (raw)


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;
 




                 reply	other threads:[~2005-01-06 23:28 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.61.0501070028010.3430@dragon.hygekrogen.localhost \
    --to=juhl-lkml@dif.dk \
    --cc=agulbra@nvg.unit.no \
    --cc=jorge@laser.satlink.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-net@vger.kernel.org \
    --cc=netdev@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®