[patch 2.6.13 1/3] 3c59x: bounds checking for hw_checksums

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Add bounds checking to usage of hw_checksums module parameter array.

Signed-off-by: John W. Linville <[email protected]>
---

 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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]
  Powered by Linux