netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch 2.6.13 1/3] 3c59x: bounds checking for hw_checksums
  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
  2005-09-12 14:48   ` [patch 2.6.13 2/3] 3c59x: cleanup init of module parameter arrays John W. Linville
  0 siblings, 1 reply; 4+ messages in thread
From: John W. Linville @ 2005-09-12 14:48 UTC (permalink / raw)
  To: linux-kernel, netdev; +Cc: akpm, jgarzik

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [patch 2.6.13 0/3] 3c59x misc fixes
@ 2005-09-12 14:48 John W. Linville
  2005-09-12 14:48 ` [patch 2.6.13 1/3] 3c59x: bounds checking for hw_checksums John W. Linville
  0 siblings, 1 reply; 4+ messages in thread
From: John W. Linville @ 2005-09-12 14:48 UTC (permalink / raw)
  To: linux-kernel, netdev; +Cc: akpm, jgarzik

A collection of patches for the 3c59x driver:

	-- Add bounds checking for hw_checksums array

	-- Use cleaner method for array initialization

	-- Fix some typos in the module param descriptions

Patches to follow...

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [patch 2.6.13 3/3] 3c59x: fix some grammar in module parameter descriptions
  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     ` John W. Linville
  0 siblings, 0 replies; 4+ messages in thread
From: John W. Linville @ 2005-09-12 14:48 UTC (permalink / raw)
  To: linux-kernel, netdev; +Cc: akpm, jgarzik

Correct several (apparently cut & paste) grammatical typos in module
parameter descriptions. They seem to have originated as copies of
the description for "global_options".

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

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

diff --git a/drivers/net/3c59x.c b/drivers/net/3c59x.c
--- a/drivers/net/3c59x.c
+++ b/drivers/net/3c59x.c
@@ -943,18 +943,18 @@ MODULE_PARM_DESC(debug, "3c59x debug lev
 MODULE_PARM_DESC(options, "3c59x: Bits 0-3: media type, bit 4: bus mastering, bit 9: full duplex");
 MODULE_PARM_DESC(global_options, "3c59x: same as options, but applies to all NICs if options is unset");
 MODULE_PARM_DESC(full_duplex, "3c59x full duplex setting(s) (1)");
-MODULE_PARM_DESC(global_full_duplex, "3c59x: same as full_duplex, but applies to all NICs if options is unset");
+MODULE_PARM_DESC(global_full_duplex, "3c59x: same as full_duplex, but applies to all NICs if full_duplex is unset");
 MODULE_PARM_DESC(hw_checksums, "3c59x Hardware checksum checking by adapter(s) (0-1)");
 MODULE_PARM_DESC(flow_ctrl, "3c59x 802.3x flow control usage (PAUSE only) (0-1)");
 MODULE_PARM_DESC(enable_wol, "3c59x: Turn on Wake-on-LAN for adapter(s) (0-1)");
-MODULE_PARM_DESC(global_enable_wol, "3c59x: same as enable_wol, but applies to all NICs if options is unset");
+MODULE_PARM_DESC(global_enable_wol, "3c59x: same as enable_wol, but applies to all NICs if enable_wol is unset");
 MODULE_PARM_DESC(rx_copybreak, "3c59x copy breakpoint for copy-only-tiny-frames");
 MODULE_PARM_DESC(max_interrupt_work, "3c59x maximum events handled per interrupt");
 MODULE_PARM_DESC(compaq_ioaddr, "3c59x PCI I/O base address (Compaq BIOS problem workaround)");
 MODULE_PARM_DESC(compaq_irq, "3c59x PCI IRQ number (Compaq BIOS problem workaround)");
 MODULE_PARM_DESC(compaq_device_id, "3c59x PCI device ID (Compaq BIOS problem workaround)");
 MODULE_PARM_DESC(watchdog, "3c59x transmit timeout in milliseconds");
-MODULE_PARM_DESC(global_use_mmio, "3c59x: same as use_mmio, but applies to all NICs if options is unset");
+MODULE_PARM_DESC(global_use_mmio, "3c59x: same as use_mmio, but applies to all NICs if use_mmio is unset");
 MODULE_PARM_DESC(use_mmio, "3c59x: use memory-mapped PCI I/O resource (0-1)");
 
 #ifdef CONFIG_NET_POLL_CONTROLLER

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [patch 2.6.13 2/3] 3c59x: cleanup init of module parameter arrays
  2005-09-12 14:48 ` [patch 2.6.13 1/3] 3c59x: bounds checking for hw_checksums John W. Linville
@ 2005-09-12 14:48   ` 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
  0 siblings, 1 reply; 4+ messages in thread
From: John W. Linville @ 2005-09-12 14:48 UTC (permalink / raw)
  To: linux-kernel, netdev; +Cc: akpm, jgarzik

Beautify the array initilizations for the module parameters.

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

 drivers/net/3c59x.c |   12 ++++++------
 1 files changed, 6 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
@@ -903,12 +903,12 @@ static void set_8021q_mode(struct net_de
 /* This driver uses 'options' to pass the media type, full-duplex flag, etc. */
 /* Option count limit only -- unlimited interfaces are supported. */
 #define MAX_UNITS 8
-static int options[MAX_UNITS] = { -1, -1, -1, -1, -1, -1, -1, -1,};
-static int full_duplex[MAX_UNITS] = {-1, -1, -1, -1, -1, -1, -1, -1};
-static int hw_checksums[MAX_UNITS] = {-1, -1, -1, -1, -1, -1, -1, -1};
-static int flow_ctrl[MAX_UNITS] = {-1, -1, -1, -1, -1, -1, -1, -1};
-static int enable_wol[MAX_UNITS] = {-1, -1, -1, -1, -1, -1, -1, -1};
-static int use_mmio[MAX_UNITS] = {-1, -1, -1, -1, -1, -1, -1, -1};
+static int options[MAX_UNITS] = { [0 ... MAX_UNITS-1] = -1 };
+static int full_duplex[MAX_UNITS] = { [0 ... MAX_UNITS-1] = -1 };
+static int hw_checksums[MAX_UNITS] = { [0 ... MAX_UNITS-1] = -1 };
+static int flow_ctrl[MAX_UNITS] = { [0 ... MAX_UNITS-1] = -1 };
+static int enable_wol[MAX_UNITS] = { [0 ... MAX_UNITS-1] = -1 };
+static int use_mmio[MAX_UNITS] = { [0 ... MAX_UNITS-1] = -1 };
 static int global_options = -1;
 static int global_full_duplex = -1;
 static int global_enable_wol = -1;

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-09-12 14:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-09-12 14:48 [patch 2.6.13 0/3] 3c59x misc fixes John W. Linville
2005-09-12 14:48 ` [patch 2.6.13 1/3] 3c59x: bounds checking for hw_checksums John W. Linville
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

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).