summaryrefslogtreecommitdiffstats
path: root/drivers/scsi/lpfc/lpfc_attr.c
diff options
context:
space:
mode:
authorMaurizio Lombardi <mlombard@redhat.com>2017-04-18 11:55:51 +0200
committerMartin K. Petersen <martin.petersen@oracle.com>2017-04-18 22:01:19 -0400
commitea98ab34c4339bc638fa394bf1bf0c6863fa88f4 (patch)
treee0bcbab0e5d228d3234d8a92a9fc12bef0fb83de /drivers/scsi/lpfc/lpfc_attr.c
parentcb22bdc8cd5a7a4fdb9a02a64a29bb81a95e6738 (diff)
downloadlinux-ea98ab34c4339bc638fa394bf1bf0c6863fa88f4.tar.gz
linux-ea98ab34c4339bc638fa394bf1bf0c6863fa88f4.tar.bz2
linux-ea98ab34c4339bc638fa394bf1bf0c6863fa88f4.zip
scsi: lpfc: fix potential buffer overflow.
This patch fixes a potential buffer overflow in lpfc_nvme_info_show(). Signed-off-by: Maurizio Lombardi <mlombard@redhat.com> Reviewed-by: Ewan D. Milne <emilne@redhat.com> Acked-by: James Smart <james.smart@broadcom.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_attr.c')
-rw-r--r--drivers/scsi/lpfc/lpfc_attr.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c
index 5c783ef7f260..7c2801b04e18 100644
--- a/drivers/scsi/lpfc/lpfc_attr.c
+++ b/drivers/scsi/lpfc/lpfc_attr.c
@@ -181,7 +181,7 @@ lpfc_nvme_info_show(struct device *dev, struct device_attribute *attr,
wwn_to_u64(vport->fc_nodename.u.wwn),
phba->targetport->port_id);
- len += snprintf(buf + len, PAGE_SIZE,
+ len += snprintf(buf + len, PAGE_SIZE - len,
"\nNVME Target: Statistics\n");
tgtp = (struct lpfc_nvmet_tgtport *)phba->targetport->private;
len += snprintf(buf+len, PAGE_SIZE-len,
@@ -326,7 +326,7 @@ lpfc_nvme_info_show(struct device *dev, struct device_attribute *attr,
}
spin_unlock_irq(shost->host_lock);
- len += snprintf(buf + len, PAGE_SIZE, "\nNVME Statistics\n");
+ len += snprintf(buf + len, PAGE_SIZE - len, "\nNVME Statistics\n");
len += snprintf(buf+len, PAGE_SIZE-len,
"LS: Xmt %016llx Cmpl %016llx\n",
phba->fc4NvmeLsRequests,