]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
cxlflash: off by one bug in cxlflash_show_port_status()
authorDan Carpenter <dan.carpenter@oracle.com>
Fri, 14 Aug 2015 20:35:25 +0000 (23:35 +0300)
committerJames Bottomley <JBottomley@Odin.com>
Thu, 27 Aug 2015 01:06:31 +0000 (18:06 -0700)
The > should be >= or we read one element past the end of the array.

Fixes: c21e0bbfc485 ('cxlflash: Base support for IBM CXL Flash Adapter')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
drivers/scsi/cxlflash/main.c

index 458ed838f83a1a31677dc5cbc4fff88a0748a6b8..fde2ba9342dcb119c61fb1c92df2f1f6a6ef8f82 100644 (file)
@@ -586,7 +586,7 @@ static ssize_t cxlflash_show_port_status(struct device *dev,
        u64 *fc_regs;
 
        rc = kstrtouint((attr->attr.name + 4), 10, &port);
-       if (rc || (port > NUM_FC_PORTS))
+       if (rc || (port >= NUM_FC_PORTS))
                return 0;
 
        fc_regs = &afu->afu_map->global.fc_regs[port][0];