cxlflash: a couple off by one bugs
Subsystems (2)
PATCH RESEND 1/1 cxlflash: a couple off by one bugs
From: Dan Carpenter <[email protected]>
The "> MAX_CONTEXT" should be ">= MAX_CONTEXT". Otherwise we go one step beyond the end of the cfg->ctx_tbl[] array.
---
This patch was originally sent by Dan Carpenter in September 2015. I had based my large patch series that went into 4.4 off of it but this patch appears to have not made it in. As a valid fix, I'd like to see this make it into 'next'. I've gone ahead and performed the rebase so that it applies cleanly.
drivers/scsi/cxlflash/superpipe.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/cxlflash/superpipe.c +2 -2
@@ -1380,7 +1380,7 @@ static int cxlflash_disk_attach(struct scsi_device *sdev, } 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 cxlflash_cfg *cfg, struct ctx_info *ctxi) } 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;
Signature · 1 line
2.1.0
Quoted 41 lines · Matthew R. Ochs
From: Dan Carpenter <[email protected]>
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 <[email protected]>Reviewed-by Manoj Kumar <[email protected]>Acked-by Matthew R. Ochs <[email protected]>Signed-off-by Matthew R. Ochs <[email protected]>---
This patch was originally sent by Dan Carpenter in September 2015. I had based my large patch series that went into 4.4 off of it but this patch appears to have not made it in. As a valid fix, I'd like to see this make it into 'next'. I've gone ahead and performed the rebase so that it applies cleanly.drivers/scsi/cxlflash/superpipe.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)drivers/scsi/cxlflash/superpipe.c +0
-0@@ -1380,7 +1380,7 @@ static int cxlflash_disk_attach(struct scsi_device *sdev, }
ctxid =cxl_process_element(ctx);drivers/scsi/cxlflash/superpipe.c +1
-1-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;drivers/scsi/cxlflash/superpipe.c +0
-0@@ -1508,7 +1508,7 @@ static int recover_context(struct cxlflash_cfg *cfg, struct ctx_info *ctxi) }
ctxid =cxl_process_element(ctx);drivers/scsi/cxlflash/superpipe.c +1
-1-if (unlikely ((ctxid >MAX_CONTEXT ) || (ctxid <0 ))) { +if (unlikely ((ctxid >=MAX_CONTEXT ) || (ctxid <0 ))) {
Quoted 3 lines
dev_err(dev, "%s: ctxid (%d) invalid!\n", __func__, ctxid); rc =-EPERM;
goto err1;
Martin K. Petersen
AppliedQuoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Matthew" = Matthew R Ochs <[email protected]> writes:
Matthew> The "> MAX_CONTEXT" should be ">= MAX_CONTEXT". Otherwise we Matthew> go one step beyond the end of the cfg->ctx_tbl[] array.
Applied to 4.5/scsi-queue.
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering