* [PATCH] netxen : Error return off by one for XG port.
@ 2012-06-20 10:52 santosh nayak
2012-06-20 13:06 ` Rajesh Borundia
2012-06-25 22:27 ` David Miller
0 siblings, 2 replies; 5+ messages in thread
From: santosh nayak @ 2012-06-20 10:52 UTC (permalink / raw)
To: sony.chacko, rajesh.borundia; +Cc: netdev, kernel-janitors, Santosh Nayak
From: Santosh Nayak <santoshprasadnayak@gmail.com>
There are NETXEN_NIU_MAX_XG_PORTS ports.
Port indexing starts from zero.
Hence we should also return error for 'port == NETXEN_NIU_MAX_XG_PORTS'.
Signed-off-by: Santosh Nayak <santoshprasadnayak@gmail.com>
---
.../ethernet/qlogic/netxen/netxen_nic_ethtool.c | 4 ++--
drivers/net/ethernet/qlogic/netxen/netxen_nic_hw.c | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic_ethtool.c b/drivers/net/ethernet/qlogic/netxen/netxen_nic_ethtool.c
index d4f179f..9103e3e 100644
--- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_ethtool.c
+++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_ethtool.c
@@ -511,7 +511,7 @@ netxen_nic_get_pauseparam(struct net_device *dev,
break;
}
} else if (adapter->ahw.port_type == NETXEN_NIC_XGBE) {
- if ((port < 0) || (port > NETXEN_NIU_MAX_XG_PORTS))
+ if ((port < 0) || (port >= NETXEN_NIU_MAX_XG_PORTS))
return;
pause->rx_pause = 1;
val = NXRD32(adapter, NETXEN_NIU_XG_PAUSE_CTL);
@@ -577,7 +577,7 @@ netxen_nic_set_pauseparam(struct net_device *dev,
}
NXWR32(adapter, NETXEN_NIU_GB_PAUSE_CTL, val);
} else if (adapter->ahw.port_type == NETXEN_NIC_XGBE) {
- if ((port < 0) || (port > NETXEN_NIU_MAX_XG_PORTS))
+ if ((port < 0) || (port >= NETXEN_NIU_MAX_XG_PORTS))
return -EIO;
val = NXRD32(adapter, NETXEN_NIU_XG_PAUSE_CTL);
if (port == 0) {
diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic_hw.c b/drivers/net/ethernet/qlogic/netxen/netxen_nic_hw.c
index de96a94..946160f 100644
--- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_hw.c
+++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_hw.c
@@ -365,7 +365,7 @@ static int netxen_niu_disable_xg_port(struct netxen_adapter *adapter)
if (NX_IS_REVISION_P3(adapter->ahw.revision_id))
return 0;
- if (port > NETXEN_NIU_MAX_XG_PORTS)
+ if (port >= NETXEN_NIU_MAX_XG_PORTS)
return -EINVAL;
mac_cfg = 0;
@@ -392,7 +392,7 @@ static int netxen_p2_nic_set_promisc(struct netxen_adapter *adapter, u32 mode)
u32 port = adapter->physical_port;
u16 board_type = adapter->ahw.board_type;
- if (port > NETXEN_NIU_MAX_XG_PORTS)
+ if (port >= NETXEN_NIU_MAX_XG_PORTS)
return -EINVAL;
mac_cfg = NXRD32(adapter, NETXEN_NIU_XGE_CONFIG_0 + (0x10000 * port));
--
1.7.4.4
^ permalink raw reply related [flat|nested] 5+ messages in thread* RE: [PATCH] netxen : Error return off by one for XG port.
2012-06-20 10:52 [PATCH] netxen : Error return off by one for XG port santosh nayak
@ 2012-06-20 13:06 ` Rajesh Borundia
2012-06-25 22:27 ` David Miller
2012-06-25 22:27 ` David Miller
1 sibling, 1 reply; 5+ messages in thread
From: Rajesh Borundia @ 2012-06-20 13:06 UTC (permalink / raw)
To: santosh nayak, Sony Chacko; +Cc: netdev, kernel-janitors@vger.kernel.org
______________________________________
From: santosh nayak [santoshprasadnayak@gmail.com]
Sent: Wednesday, June 20, 2012 4:22 PM
To: Sony Chacko; Rajesh Borundia
Cc: netdev; kernel-janitors@vger.kernel.org; Santosh Nayak
Subject: [PATCH] netxen : Error return off by one for XG port.
From: Santosh Nayak <santoshprasadnayak@gmail.com>
There are NETXEN_NIU_MAX_XG_PORTS ports.
Port indexing starts from zero.
Hence we should also return error for 'port == NETXEN_NIU_MAX_XG_PORTS'.
Signed-off-by: Santosh Nayak <santoshprasadnayak@gmail.com>
---
.../ethernet/qlogic/netxen/netxen_nic_ethtool.c | 4 ++--
drivers/net/ethernet/qlogic/netxen/netxen_nic_hw.c | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic_ethtool.c b/drivers/net/ethernet/qlogic/netxen/netxen_nic_ethtool.c
index d4f179f..9103e3e 100644
--- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_ethtool.c
+++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_ethtool.c
@@ -511,7 +511,7 @@ netxen_nic_get_pauseparam(struct net_device *dev,
break;
}
} else if (adapter->ahw.port_type == NETXEN_NIC_XGBE) {
- if ((port < 0) || (port > NETXEN_NIU_MAX_XG_PORTS))
+ if ((port < 0) || (port >= NETXEN_NIU_MAX_XG_PORTS))
return;
pause->rx_pause = 1;
val = NXRD32(adapter, NETXEN_NIU_XG_PAUSE_CTL);
@@ -577,7 +577,7 @@ netxen_nic_set_pauseparam(struct net_device *dev,
}
NXWR32(adapter, NETXEN_NIU_GB_PAUSE_CTL, val);
} else if (adapter->ahw.port_type == NETXEN_NIC_XGBE) {
- if ((port < 0) || (port > NETXEN_NIU_MAX_XG_PORTS))
+ if ((port < 0) || (port >= NETXEN_NIU_MAX_XG_PORTS))
return -EIO;
val = NXRD32(adapter, NETXEN_NIU_XG_PAUSE_CTL);
if (port == 0) {
diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic_hw.c b/drivers/net/ethernet/qlogic/netxen/netxen_nic_hw.c
index de96a94..946160f 100644
--- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_hw.c
+++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_hw.c
@@ -365,7 +365,7 @@ static int netxen_niu_disable_xg_port(struct netxen_adapter *adapter)
if (NX_IS_REVISION_P3(adapter->ahw.revision_id))
return 0;
- if (port > NETXEN_NIU_MAX_XG_PORTS)
+ if (port >= NETXEN_NIU_MAX_XG_PORTS)
return -EINVAL;
mac_cfg = 0;
@@ -392,7 +392,7 @@ static int netxen_p2_nic_set_promisc(struct netxen_adapter *adapter, u32 mode)
u32 port = adapter->physical_port;
u16 board_type = adapter->ahw.board_type;
- if (port > NETXEN_NIU_MAX_XG_PORTS)
+ if (port >= NETXEN_NIU_MAX_XG_PORTS)
return -EINVAL;
mac_cfg = NXRD32(adapter, NETXEN_NIU_XGE_CONFIG_0 + (0x10000 * port));
--
1.7.4.4
Looks ok to me.
Rajesh
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH] netxen : Error return off by one for XG port.
2012-06-20 13:06 ` Rajesh Borundia
@ 2012-06-25 22:27 ` David Miller
2012-06-26 5:06 ` Rajesh Borundia
0 siblings, 1 reply; 5+ messages in thread
From: David Miller @ 2012-06-25 22:27 UTC (permalink / raw)
To: rajesh.borundia; +Cc: santoshprasadnayak, sony.chacko, netdev, kernel-janitors
From: Rajesh Borundia <rajesh.borundia@qlogic.com>
Date: Wed, 20 Jun 2012 08:06:04 -0500
> ______________________________________
> From: santosh nayak [santoshprasadnayak@gmail.com]
> Sent: Wednesday, June 20, 2012 4:22 PM
> To: Sony Chacko; Rajesh Borundia
> Cc: netdev; kernel-janitors@vger.kernel.org; Santosh Nayak
> Subject: [PATCH] netxen : Error return off by one for XG port.
This is not the correct way to submit patches written by other
people.
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [PATCH] netxen : Error return off by one for XG port.
2012-06-25 22:27 ` David Miller
@ 2012-06-26 5:06 ` Rajesh Borundia
0 siblings, 0 replies; 5+ messages in thread
From: Rajesh Borundia @ 2012-06-26 5:06 UTC (permalink / raw)
To: David Miller
Cc: santoshprasadnayak@gmail.com, Sony Chacko, netdev,
kernel-janitors@vger.kernel.org
> -----Original Message-----
> From: David Miller [mailto:davem@davemloft.net]
> Sent: Tuesday, June 26, 2012 3:58 AM
> To: Rajesh Borundia
> Cc: santoshprasadnayak@gmail.com; Sony Chacko; netdev; kernel-
> janitors@vger.kernel.org
> Subject: Re: [PATCH] netxen : Error return off by one for XG port.
>
> From: Rajesh Borundia <rajesh.borundia@qlogic.com>
> Date: Wed, 20 Jun 2012 08:06:04 -0500
>
> > ______________________________________
> > From: santosh nayak [santoshprasadnayak@gmail.com]
> > Sent: Wednesday, June 20, 2012 4:22 PM
> > To: Sony Chacko; Rajesh Borundia
> > Cc: netdev; kernel-janitors@vger.kernel.org; Santosh Nayak
> > Subject: [PATCH] netxen : Error return off by one for XG port.
>
> This is not the correct way to submit patches written by other
> people.
I just ack-ed the patch. I did it in incorrect way (formatting in a mail).
Sorry for the trouble.
Rajesh
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] netxen : Error return off by one for XG port.
2012-06-20 10:52 [PATCH] netxen : Error return off by one for XG port santosh nayak
2012-06-20 13:06 ` Rajesh Borundia
@ 2012-06-25 22:27 ` David Miller
1 sibling, 0 replies; 5+ messages in thread
From: David Miller @ 2012-06-25 22:27 UTC (permalink / raw)
To: santoshprasadnayak; +Cc: sony.chacko, rajesh.borundia, netdev, kernel-janitors
From: santosh nayak <santoshprasadnayak@gmail.com>
Date: Wed, 20 Jun 2012 16:22:58 +0530
> From: Santosh Nayak <santoshprasadnayak@gmail.com>
>
> There are NETXEN_NIU_MAX_XG_PORTS ports.
> Port indexing starts from zero.
> Hence we should also return error for 'port == NETXEN_NIU_MAX_XG_PORTS'.
>
> Signed-off-by: Santosh Nayak <santoshprasadnayak@gmail.com>
Applied.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-06-26 5:06 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-20 10:52 [PATCH] netxen : Error return off by one for XG port santosh nayak
2012-06-20 13:06 ` Rajesh Borundia
2012-06-25 22:27 ` David Miller
2012-06-26 5:06 ` Rajesh Borundia
2012-06-25 22:27 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).