* [PATCH] scsi: fcoe: fix off-by-one array size comparison
@ 2016-10-06 18:26 Colin King
0 siblings, 0 replies; only message in thread
From: Colin King @ 2016-10-06 18:26 UTC (permalink / raw)
To: Johannes Thumshirn, James E . J . Bottomley, Martin K . Petersen,
fcoe-devel, linux-scsi
Cc: linux-kernel
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
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2016-10-06 18:26 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-06 18:26 [PATCH] scsi: fcoe: fix off-by-one array size comparison Colin King
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).