Commit 46c6d45d authored by Dan Carpenter's avatar Dan Carpenter Committed by James Bottomley

cxlflash: off by one bug in cxlflash_show_port_status()

The > should be >= or we read one element past the end of the array.

Fixes: c21e0bbf ('cxlflash: Base support for IBM CXL Flash Adapter')
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Acked-by: default avatarMatthew R. Ochs <mrochs@linux.vnet.ibm.com>
Signed-off-by: default avatarJames Bottomley <JBottomley@Odin.com>
parent 2cb79266
...@@ -586,7 +586,7 @@ static ssize_t cxlflash_show_port_status(struct device *dev, ...@@ -586,7 +586,7 @@ static ssize_t cxlflash_show_port_status(struct device *dev,
u64 *fc_regs; u64 *fc_regs;
rc = kstrtouint((attr->attr.name + 4), 10, &port); rc = kstrtouint((attr->attr.name + 4), 10, &port);
if (rc || (port > NUM_FC_PORTS)) if (rc || (port >= NUM_FC_PORTS))
return 0; return 0;
fc_regs = &afu->afu_map->global.fc_regs[port][0]; fc_regs = &afu->afu_map->global.fc_regs[port][0];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment