From: Colin King <colin.king@canonical.com>
To: Johannes Thumshirn <jth@kernel.org>,
"James E . J . Bottomley" <jejb@linux.vnet.ibm.com>,
"Martin K . Petersen" <martin.petersen@oracle.com>,
fcoe-devel@open-fcoe.org, linux-scsi@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] scsi: fcoe: fix off-by-one array size comparison
Date: Thu, 6 Oct 2016 19:26:20 +0100 [thread overview]
Message-ID: <20161006182620.32208-1-colin.king@canonical.com> (raw)
From: Colin Ian King <colin.king@canonical.com>
Fix an off-by-one array size comparison that is comparing one too many
items in an array and hence will causing an out-of-bounds array read
on array fcoe_port_speed_mapping.
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
drivers/scsi/fcoe/fcoe_transport.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/scsi/fcoe/fcoe_transport.c b/drivers/scsi/fcoe/fcoe_transport.c
index c164eec..375c536 100644
--- a/drivers/scsi/fcoe/fcoe_transport.c
+++ b/drivers/scsi/fcoe/fcoe_transport.c
@@ -110,7 +110,7 @@ static inline u32 eth2fc_speed(u32 eth_port_speed)
{
int i;
- for (i = 0; i <= ARRAY_SIZE(fcoe_port_speed_mapping); i++) {
+ for (i = 0; i < ARRAY_SIZE(fcoe_port_speed_mapping); i++) {
if (fcoe_port_speed_mapping[i].eth_port_speed == eth_port_speed)
return fcoe_port_speed_mapping[i].fc_port_speed;
}
--
2.9.3
reply other threads:[~2016-10-06 18:26 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20161006182620.32208-1-colin.king@canonical.com \
--to=colin.king@canonical.com \
--cc=fcoe-devel@open-fcoe.org \
--cc=jejb@linux.vnet.ibm.com \
--cc=jth@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.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).