From: santosh nayak <santoshprasadnayak@gmail.com>
To: sony.chacko@qlogic.com, rajesh.borundia@qlogic.com
Cc: netdev@vger.kernel.org, kernel-janitors@vger.kernel.org,
Santosh Nayak <santoshprasadnayak@gmail.com>
Subject: [PATCH] netxen: Error return off by one in 'netxen_nic_set_pauseparam()'.
Date: Wed, 20 Jun 2012 12:57:39 +0530 [thread overview]
Message-ID: <1340177259-14083-1-git-send-email-santoshprasadnayak@gmail.com> (raw)
From: Santosh Nayak <santoshprasadnayak@gmail.com>
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>
---
Destination tree "linux-next"
.../ethernet/qlogic/netxen/netxen_nic_ethtool.c | 4 ++--
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 3973040..d4f179f 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,
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));
--
1.7.4.4
next reply other threads:[~2012-06-20 7:27 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-20 7:27 santosh nayak [this message]
2012-06-20 7:44 ` [PATCH] netxen: Error return off by one in 'netxen_nic_set_pauseparam()' Dan Carpenter
2012-06-20 7:59 ` santosh prasad nayak
2012-06-20 9:51 ` Rajesh Borundia
2012-06-20 10:16 ` santosh prasad nayak
2012-06-20 7:57 ` Dan Carpenter
2012-06-25 22:27 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1340177259-14083-1-git-send-email-santoshprasadnayak@gmail.com \
--to=santoshprasadnayak@gmail.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=rajesh.borundia@qlogic.com \
--cc=sony.chacko@qlogic.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).