lkml.org 
[lkml]   [2005]   [Sep]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
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/
\
 
 \ /
  Last update: 2005-09-12 17:01    [W:0.023 / U:0.056 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site