summaryrefslogtreecommitdiff
path: root/drivers/net/s2io.h
diff options
context:
space:
mode:
authorJon Mason <jon.mason@exar.com>2010-12-10 15:40:01 +0000
committerDavid S. Miller <davem@davemloft.net>2010-12-11 11:46:36 -0800
commit1853e2e15dc95ff3430530941b5856581251ef70 (patch)
tree0ae74601e624a49ebab41de725e2793fbfddb564 /drivers/net/s2io.h
parent9835fd7321a67feba6432e63bf2cba43f5a56bd9 (diff)
s2io: rx_ring_sz bounds checking
modparm rx_ring_sz can be set to be greater than the maximum allowable number of blocks. This results in an array overrun when probing the driver, and causes memory corruption. Also, the MAX_RX_DESC_1 multiply the max number of rings by max number of blocker per ring by 127, but the driver does the same calculation with 127+1. This results in the possibility of the value being set being larger than the maximum allowable value. Finally, clean-up the s2io_ethtool_gringparam code to be more intuitive. Signed-off-by: Jon Mason <jon.mason@exar.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/s2io.h')
-rw-r--r--drivers/net/s2io.h5
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/net/s2io.h b/drivers/net/s2io.h
index 00b8614efe48..1671443b3c0e 100644
--- a/drivers/net/s2io.h
+++ b/drivers/net/s2io.h
@@ -355,9 +355,8 @@ struct stat_block {
#define FIFO_OTHER_MAX_NUM 1
-#define MAX_RX_DESC_1 (MAX_RX_RINGS * MAX_RX_BLOCKS_PER_RING * 127 )
-#define MAX_RX_DESC_2 (MAX_RX_RINGS * MAX_RX_BLOCKS_PER_RING * 85 )
-#define MAX_RX_DESC_3 (MAX_RX_RINGS * MAX_RX_BLOCKS_PER_RING * 85 )
+#define MAX_RX_DESC_1 (MAX_RX_RINGS * MAX_RX_BLOCKS_PER_RING * 128)
+#define MAX_RX_DESC_2 (MAX_RX_RINGS * MAX_RX_BLOCKS_PER_RING * 86)
#define MAX_TX_DESC (MAX_AVAILABLE_TXDS)
/* FIFO mappings for all possible number of fifos configured */