diff options
-rw-r--r-- | drivers/scsi/cxlflash/main.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/scsi/cxlflash/main.c b/drivers/scsi/cxlflash/main.c index 077f62e208aa..6a4367cc9caa 100644 --- a/drivers/scsi/cxlflash/main.c +++ b/drivers/scsi/cxlflash/main.c | |||
@@ -3401,9 +3401,10 @@ static int cxlflash_afu_debug(struct cxlflash_cfg *cfg, | |||
3401 | if (is_write) { | 3401 | if (is_write) { |
3402 | req_flags |= SISL_REQ_FLAGS_HOST_WRITE; | 3402 | req_flags |= SISL_REQ_FLAGS_HOST_WRITE; |
3403 | 3403 | ||
3404 | rc = copy_from_user(kbuf, ubuf, ulen); | 3404 | if (copy_from_user(kbuf, ubuf, ulen)) { |
3405 | if (unlikely(rc)) | 3405 | rc = -EFAULT; |
3406 | goto out; | 3406 | goto out; |
3407 | } | ||
3407 | } | 3408 | } |
3408 | } | 3409 | } |
3409 | 3410 | ||
@@ -3431,8 +3432,10 @@ static int cxlflash_afu_debug(struct cxlflash_cfg *cfg, | |||
3431 | goto out; | 3432 | goto out; |
3432 | } | 3433 | } |
3433 | 3434 | ||
3434 | if (ulen && !is_write) | 3435 | if (ulen && !is_write) { |
3435 | rc = copy_to_user(ubuf, kbuf, ulen); | 3436 | if (copy_to_user(ubuf, kbuf, ulen)) |
3437 | rc = -EFAULT; | ||
3438 | } | ||
3436 | out: | 3439 | out: |
3437 | kfree(buf); | 3440 | kfree(buf); |
3438 | dev_dbg(dev, "%s: returning rc=%d\n", __func__, rc); | 3441 | dev_dbg(dev, "%s: returning rc=%d\n", __func__, rc); |