提交 46c6d45d 编写于 作者: D Dan Carpenter 提交者: 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: NDan Carpenter <dan.carpenter@oracle.com>
Acked-by: NMatthew R. Ochs <mrochs@linux.vnet.ibm.com>
Signed-off-by: NJames Bottomley <JBottomley@Odin.com>
上级 2cb79266
......@@ -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];
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册