Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

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
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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];