public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] cxlflash: off by one bug in cxlflash_show_port_status()
@ 2015-08-14 20:35 Dan Carpenter
  2015-08-16  2:52 ` Matthew R. Ochs
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2015-08-14 20:35 UTC (permalink / raw)
  To: James E.J. Bottomley, Matthew R. Ochs
  Cc: Brian King, Michael Neuling, Manoj N. Kumar, linux-scsi,
	kernel-janitors

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>

Fixes: c21e0bbfc485 ('cxlflash: Base support for IBM CXL Flash Adapter')
diff --git a/drivers/scsi/cxlflash/main.c b/drivers/scsi/cxlflash/main.c
index 0720d2f..fd70101 100644
--- a/drivers/scsi/cxlflash/main.c
+++ b/drivers/scsi/cxlflash/main.c
@@ -539,7 +539,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];

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [patch] cxlflash: off by one bug in cxlflash_show_port_status()
  2015-08-14 20:35 [patch] cxlflash: off by one bug in cxlflash_show_port_status() Dan Carpenter
@ 2015-08-16  2:52 ` Matthew R. Ochs
  0 siblings, 0 replies; 2+ messages in thread
From: Matthew R. Ochs @ 2015-08-16  2:52 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: James E.J. Bottomley, Brian King, Michael Neuling, Manoj N. Kumar,
	linux-scsi, kernel-janitors

> On Aug 14, 2015, at 3:35 PM, Dan Carpenter <dan.carpenter@oracle.com> wrote:
> 
> The > should be >= or we read one element past the end of the array.

Dan - Good catch!

Acked-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com>

> 
> Fixes: c21e0bbfc485 ('cxlflash: Base support for IBM CXL Flash Adapter')
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> Fixes: c21e0bbfc485 ('cxlflash: Base support for IBM CXL Flash Adapter')
> diff --git a/drivers/scsi/cxlflash/main.c b/drivers/scsi/cxlflash/main.c
> index 0720d2f..fd70101 100644
> --- a/drivers/scsi/cxlflash/main.c
> +++ b/drivers/scsi/cxlflash/main.c
> @@ -539,7 +539,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];
> 


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-08-16  2:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-14 20:35 [patch] cxlflash: off by one bug in cxlflash_show_port_status() Dan Carpenter
2015-08-16  2:52 ` Matthew R. Ochs

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox