Messages in this thread Patch in this message | ![/](/images/icornerl.gif) | | Date | Mon, 12 Sep 2005 10:48:52 -0400 | From | "John W. Linville" <> | Subject | [patch 2.6.13 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 <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 - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| ![\](/images/icornerr.gif) |