Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Santosh Nayak and committed by
David S. Miller
d8140b2f 7011d085

+2 -2
+2 -2
drivers/net/ethernet/qlogic/netxen/netxen_nic_ethtool.c
··· 489 489 int port = adapter->physical_port; 490 490 491 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 493 return; 494 494 /* get flow control settings */ 495 495 val = NXRD32(adapter, NETXEN_NIU_GB_MAC_CONFIG_0(port)); ··· 534 534 int port = adapter->physical_port; 535 535 /* read mode */ 536 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 538 return -EIO; 539 539 /* set flow control */ 540 540 val = NXRD32(adapter, NETXEN_NIU_GB_MAC_CONFIG_0(port));