From: Maurizio Lombardi Date: Tue, 18 Apr 2017 09:55:51 +0000 (+0200) Subject: scsi: lpfc: fix potential buffer overflow. X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=ea98ab34c4339bc638fa394bf1bf0c6863fa88f4;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git scsi: lpfc: fix potential buffer overflow. This patch fixes a potential buffer overflow in lpfc_nvme_info_show(). Signed-off-by: Maurizio Lombardi Reviewed-by: Ewan D. Milne Acked-by: James Smart Signed-off-by: Martin K. Petersen --- 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,