aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSantosh Nayak <santoshprasadnayak@gmail.com>2012-06-19 17:27:39 -0400
committerDavid S. Miller <davem@davemloft.net>2012-06-25 18:26:26 -0400
commitd8140b2fa09cceb947ac1ac49e0958eb137d0648 (patch)
tree1a6103ce1d53bb8c5f1da6cc141c61018f8e82ca
parent7011d0851b80a1a229acfda37ce08aad903b12d1 (diff)
netxen: Error return off by one in 'netxen_nic_set_pauseparam()'.
There are 'NETXEN_NIU_MAX_GBE_PORTS' GBE ports. Port indexing starts from zero. Hence we should also return error for "port == NETXEN_NIU_MAX_GBE_PORTS" Signed-off-by: Santosh Nayak <santoshprasadnayak@gmail.com>
-rw-r--r--drivers/net/ethernet/qlogic/netxen/netxen_nic_ethtool.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic_ethtool.c b/drivers/net/ethernet/qlogic/netxen/netxen_nic_ethtool.c
index 39730403782f..d4f179f96dcb 100644
--- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_ethtool.c
+++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_ethtool.c
@@ -489,7 +489,7 @@ netxen_nic_get_pauseparam(struct net_device *dev,
489 int port = adapter->physical_port; 489 int port = adapter->physical_port;
490 490
491 if (adapter->ahw.port_type == NETXEN_NIC_GBE) { 491 if (adapter->ahw.port_type == NETXEN_NIC_GBE) {
492 if ((port < 0) || (port > NETXEN_NIU_MAX_GBE_PORTS)) 492 if ((port < 0) || (port >= NETXEN_NIU_MAX_GBE_PORTS))
493 return; 493 return;
494 /* get flow control settings */ 494 /* get flow control settings */
495 val = NXRD32(adapter, NETXEN_NIU_GB_MAC_CONFIG_0(port)); 495 val = NXRD32(adapter, NETXEN_NIU_GB_MAC_CONFIG_0(port));
@@ -534,7 +534,7 @@ netxen_nic_set_pauseparam(struct net_device *dev,
534 int port = adapter->physical_port; 534 int port = adapter->physical_port;
535 /* read mode */ 535 /* read mode */
536 if (adapter->ahw.port_type == NETXEN_NIC_GBE) { 536 if (adapter->ahw.port_type == NETXEN_NIC_GBE) {
537 if ((port < 0) || (port > NETXEN_NIU_MAX_GBE_PORTS)) 537 if ((port < 0) || (port >= NETXEN_NIU_MAX_GBE_PORTS))
538 return -EIO; 538 return -EIO;
539 /* set flow control */ 539 /* set flow control */
540 val = NXRD32(adapter, NETXEN_NIU_GB_MAC_CONFIG_0(port)); 540 val = NXRD32(adapter, NETXEN_NIU_GB_MAC_CONFIG_0(port));