netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "John W. Linville" <linville@tuxdriver.com>
To: linux-kernel@vger.kernel.org, netdev@vger.kernel.org
Cc: akpm@osdl.org, jgarzik@pobox.com
Subject: [patch 2.6.13 1/3] 3c59x: bounds checking for hw_checksums
Date: Mon, 12 Sep 2005 10:48:52 -0400	[thread overview]
Message-ID: <09122005104852.31525@bilbo.tuxdriver.com> (raw)
In-Reply-To: <09122005104852.31469@bilbo.tuxdriver.com>

Add bounds checking to usage of hw_checksums module parameter array.

Signed-off-by: John W. Linville <linville@tuxdriver.com>
---

 drivers/net/3c59x.c |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/drivers/net/3c59x.c b/drivers/net/3c59x.c
--- a/drivers/net/3c59x.c
+++ b/drivers/net/3c59x.c
@@ -1536,9 +1536,11 @@ static int __devinit vortex_probe1(struc
 		dev->hard_start_xmit = boomerang_start_xmit;
 		/* Actually, it still should work with iommu. */
 		dev->features |= NETIF_F_SG;
-		if (((hw_checksums[card_idx] == -1) && (vp->drv_flags & HAS_HWCKSM)) ||
-					(hw_checksums[card_idx] == 1)) {
-				dev->features |= NETIF_F_IP_CSUM;
+		if ((card_idx < MAX_UNITS) &&
+		    (((hw_checksums[card_idx] == -1) &&
+		      (vp->drv_flags & HAS_HWCKSM)) ||
+		     (hw_checksums[card_idx] == 1))) {
+			dev->features |= NETIF_F_IP_CSUM;
 		}
 	} else {
 		dev->hard_start_xmit = vortex_start_xmit;
@@ -2811,9 +2813,10 @@ vortex_close(struct net_device *dev)
 	}
 
 #if DO_ZEROCOPY
-	if (	vp->rx_csumhits &&
-			((vp->drv_flags & HAS_HWCKSM) == 0) &&
-			(hw_checksums[vp->card_idx] == -1)) {
+	if (vp->rx_csumhits &&
+	    ((vp->drv_flags & HAS_HWCKSM) == 0) &&
+	    ((vp->card_idx >= MAX_UNITS) ||
+	     (hw_checksums[vp->card_idx] == -1))) {
 		printk(KERN_WARNING "%s supports hardware checksums, and we're not using them!\n", dev->name);
 	}
 #endif

  reply	other threads:[~2005-09-12 14:48 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-12 14:48 [patch 2.6.13 0/3] 3c59x misc fixes John W. Linville
2005-09-12 14:48 ` John W. Linville [this message]
2005-09-12 14:48   ` [patch 2.6.13 2/3] 3c59x: cleanup init of module parameter arrays John W. Linville
2005-09-12 14:48     ` [patch 2.6.13 3/3] 3c59x: fix some grammar in module parameter descriptions John W. Linville

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=09122005104852.31525@bilbo.tuxdriver.com \
    --to=linville@tuxdriver.com \
    --cc=akpm@osdl.org \
    --cc=jgarzik@pobox.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).