Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d8140b2f authored by Santosh Nayak's avatar Santosh Nayak Committed by David S. Miller
Browse files

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: default avatarSantosh Nayak <santoshprasadnayak@gmail.com>
parent 7011d085
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -489,7 +489,7 @@ netxen_nic_get_pauseparam(struct net_device *dev,
	int port = adapter->physical_port;

	if (adapter->ahw.port_type == NETXEN_NIC_GBE) {
		if ((port < 0) || (port > NETXEN_NIU_MAX_GBE_PORTS))
		if ((port < 0) || (port >= NETXEN_NIU_MAX_GBE_PORTS))
			return;
		/* get flow control settings */
		val = NXRD32(adapter, NETXEN_NIU_GB_MAC_CONFIG_0(port));
@@ -534,7 +534,7 @@ netxen_nic_set_pauseparam(struct net_device *dev,
	int port = adapter->physical_port;
	/* read mode */
	if (adapter->ahw.port_type == NETXEN_NIC_GBE) {
		if ((port < 0) || (port > NETXEN_NIU_MAX_GBE_PORTS))
		if ((port < 0) || (port >= NETXEN_NIU_MAX_GBE_PORTS))
			return -EIO;
		/* set flow control */
		val = NXRD32(adapter, NETXEN_NIU_GB_MAC_CONFIG_0(port));