4.4-stable review patch.  If anyone has any objections, please let me know.

------------------

[ Upstream commit e37390bee6fe7dfbe507a9d50cdc11344b53fa08 ]

The "> MAX_CONTEXT" should be ">= MAX_CONTEXT".  Otherwise we go one
step beyond the end of the cfg->ctx_tbl[] array.

Signed-off-by: Dan Carpenter <dan.carpen...@oracle.com>
Reviewed-by: Manoj Kumar <ma...@linux.vnet.ibm.com>
Reviewed-by: Johannes Thumshirn <jthumsh...@suse.de>
Acked-by: Matthew R. Ochs <mro...@linux.vnet.ibm.com>
Signed-off-by: Martin K. Petersen <martin.peter...@oracle.com>
Signed-off-by: Sasha Levin <alexander.le...@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gre...@linuxfoundation.org>
---
 drivers/scsi/cxlflash/superpipe.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/drivers/scsi/cxlflash/superpipe.c
+++ b/drivers/scsi/cxlflash/superpipe.c
@@ -1380,7 +1380,7 @@ static int cxlflash_disk_attach(struct s
        }
 
        ctxid = cxl_process_element(ctx);
-       if (unlikely((ctxid > MAX_CONTEXT) || (ctxid < 0))) {
+       if (unlikely((ctxid >= MAX_CONTEXT) || (ctxid < 0))) {
                dev_err(dev, "%s: ctxid (%d) invalid!\n", __func__, ctxid);
                rc = -EPERM;
                goto err2;
@@ -1508,7 +1508,7 @@ static int recover_context(struct cxlfla
        }
 
        ctxid = cxl_process_element(ctx);
-       if (unlikely((ctxid > MAX_CONTEXT) || (ctxid < 0))) {
+       if (unlikely((ctxid >= MAX_CONTEXT) || (ctxid < 0))) {
                dev_err(dev, "%s: ctxid (%d) invalid!\n", __func__, ctxid);
                rc = -EPERM;
                goto err1;


Reply via email to