Commit 32fb5f06 authored by John W. Linville's avatar John W. Linville Committed by Linus Torvalds

[PATCH] 3c59x: bounds checking for hw_checksums

Add bounds checking to usage of hw_checksums module parameter array.
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent d9e46de3
...@@ -1513,9 +1513,10 @@ static int __devinit vortex_probe1(struct device *gendev, ...@@ -1513,9 +1513,10 @@ static int __devinit vortex_probe1(struct device *gendev,
dev->hard_start_xmit = boomerang_start_xmit; dev->hard_start_xmit = boomerang_start_xmit;
/* Actually, it still should work with iommu. */ /* Actually, it still should work with iommu. */
dev->features |= NETIF_F_SG; dev->features |= NETIF_F_SG;
if (((hw_checksums[card_idx] == -1) && (vp->drv_flags & HAS_HWCKSM)) || if (card_idx < MAX_UNITS &&
(hw_checksums[card_idx] == 1)) { ((hw_checksums[card_idx] == -1 && (vp->drv_flags & HAS_HWCKSM)) ||
dev->features |= NETIF_F_IP_CSUM; hw_checksums[card_idx] == 1)) {
dev->features |= NETIF_F_IP_CSUM;
} }
} else { } else {
dev->hard_start_xmit = vortex_start_xmit; dev->hard_start_xmit = vortex_start_xmit;
...@@ -2791,10 +2792,11 @@ vortex_close(struct net_device *dev) ...@@ -2791,10 +2792,11 @@ vortex_close(struct net_device *dev)
} }
#if DO_ZEROCOPY #if DO_ZEROCOPY
if ( vp->rx_csumhits && if (vp->rx_csumhits &&
((vp->drv_flags & HAS_HWCKSM) == 0) && (vp->drv_flags & HAS_HWCKSM) == 0 &&
(hw_checksums[vp->card_idx] == -1)) { (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); printk(KERN_WARNING "%s supports hardware checksums, and we're "
"not using them!\n", dev->name);
} }
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment