diff options
author | John W. Linville <linville@tuxdriver.com> | 2005-11-07 00:58:05 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-11-07 07:53:25 -0800 |
commit | 32fb5f06dbb6ca007f7886eb210b7b15545e2e15 (patch) | |
tree | c9a35e47f42aa54645f98d1e4d8e9d73ce411d19 /drivers/net/3c59x.c | |
parent | d9e46de34e4212f472684b1561ba323aac54ea25 (diff) |
[PATCH] 3c59x: bounds checking for hw_checksums
Add bounds checking to usage of hw_checksums module parameter array.
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/net/3c59x.c')
-rw-r--r-- | drivers/net/3c59x.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/drivers/net/3c59x.c b/drivers/net/3c59x.c index e1f773d07ed..78f90eb02b9 100644 --- a/drivers/net/3c59x.c +++ b/drivers/net/3c59x.c @@ -1513,9 +1513,10 @@ static int __devinit vortex_probe1(struct device *gendev, 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; @@ -2791,10 +2792,11 @@ 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)) { - printk(KERN_WARNING "%s supports hardware checksums, and we're not using them!\n", dev->name); + 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 |