3c59x misc fixes
Subsystems (2)
cover 3c59x misc fixes
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...
PATCH 1/3 3c59x: bounds checking for hw_checksums
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(-)
drivers/net/3c59x.c +9 -6
@@ -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
PATCH 2/3 3c59x: cleanup init of module parameter arrays
Beautify the array initilizations for the module parameters.
Signed-off-by John W. Linville <[email protected]>
---
drivers/net/3c59x.c | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-)
drivers/net/3c59x.c +6 -6
@@ -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 ;
PATCH 3/3 3c59x: fix some grammar in module parameter descriptions
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 <[email protected]>
---
drivers/net/3c59x.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/net/3c59x.c +3 -3
@@ -943,18 +943,18 @@ MODULE_PARM_DESC(debug, "3c59x debug levMODULE_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