Skip to content

Commit ea98ab3

Browse files
maurizio-lombardimartinkpetersen
authored andcommitted
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>
1 parent cb22bdc commit ea98ab3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/scsi/lpfc/lpfc_attr.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ lpfc_nvme_info_show(struct device *dev, struct device_attribute *attr,
181181
wwn_to_u64(vport->fc_nodename.u.wwn),
182182
phba->targetport->port_id);
183183

184-
len += snprintf(buf + len, PAGE_SIZE,
184+
len += snprintf(buf + len, PAGE_SIZE - len,
185185
"\nNVME Target: Statistics\n");
186186
tgtp = (struct lpfc_nvmet_tgtport *)phba->targetport->private;
187187
len += snprintf(buf+len, PAGE_SIZE-len,
@@ -326,7 +326,7 @@ lpfc_nvme_info_show(struct device *dev, struct device_attribute *attr,
326326
}
327327
spin_unlock_irq(shost->host_lock);
328328

329-
len += snprintf(buf + len, PAGE_SIZE, "\nNVME Statistics\n");
329+
len += snprintf(buf + len, PAGE_SIZE - len, "\nNVME Statistics\n");
330330
len += snprintf(buf+len, PAGE_SIZE-len,
331331
"LS: Xmt %016llx Cmpl %016llx\n",
332332
phba->fc4NvmeLsRequests,

0 commit comments

Comments
 (0)