scsi: fcoe: fix off by one in eth2fc_speed()
authorVincent Stehlé <vincent.stehle@laposte.net>
Wed, 21 Sep 2016 20:54:07 +0000 (22:54 +0200)
committerMartin K. Petersen <martin.petersen@oracle.com>
Tue, 27 Sep 2016 00:54:45 +0000 (20:54 -0400)
This should be "< ARRAY_SIZE()" instead of "<= ARRAY_SIZE()".

Fixes: 0b924e5505a568e7 ("scsi: fcoe: provide translation table between Ethernet and FC port speeds")
Signed-off-by: Vincent Stehlé <vincent.stehle@laposte.net>
Cc: Johannes Thumshirn <jthumshirn@suse.de>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/fcoe/fcoe_transport.c

index c164eec..375c536 100644 (file)
@@ -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;
        }