public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] scsi: lpfc: fix potential buffer overflow.
@ 2017-04-18  9:55 Maurizio Lombardi
  2017-04-18 15:07 ` Ewan D. Milne
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Maurizio Lombardi @ 2017-04-18  9:55 UTC (permalink / raw)
  To: james.smart; +Cc: dick.kennedy, linux-scsi, emilne, jejb, martin.petersen

This patch fixes a potential buffer overflow in lpfc_nvme_info_show().

Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
---
 drivers/scsi/lpfc/lpfc_attr.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c
index 22819af..1ce252f 100644
--- a/drivers/scsi/lpfc/lpfc_attr.c
+++ b/drivers/scsi/lpfc/lpfc_attr.c
@@ -181,7 +181,7 @@
 				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 @@
 	}
 	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,
-- 
Maurizio Lombardi

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] scsi: lpfc: fix potential buffer overflow.
  2017-04-18  9:55 [PATCH] scsi: lpfc: fix potential buffer overflow Maurizio Lombardi
@ 2017-04-18 15:07 ` Ewan D. Milne
  2017-04-18 21:15 ` James Smart
  2017-04-19  2:01 ` Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: Ewan D. Milne @ 2017-04-18 15:07 UTC (permalink / raw)
  To: Maurizio Lombardi
  Cc: james.smart, dick.kennedy, linux-scsi, jejb, martin.petersen

On Tue, 2017-04-18 at 11:55 +0200, Maurizio Lombardi wrote:
> This patch fixes a potential buffer overflow in lpfc_nvme_info_show().
> 
> Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
> ---
>  drivers/scsi/lpfc/lpfc_attr.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c
> index 22819af..1ce252f 100644
> --- a/drivers/scsi/lpfc/lpfc_attr.c
> +++ b/drivers/scsi/lpfc/lpfc_attr.c
> @@ -181,7 +181,7 @@
>  				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 @@
>  	}
>  	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,

Reviewed-by: Ewan D. Milne <emilne@redhat.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] scsi: lpfc: fix potential buffer overflow.
  2017-04-18  9:55 [PATCH] scsi: lpfc: fix potential buffer overflow Maurizio Lombardi
  2017-04-18 15:07 ` Ewan D. Milne
@ 2017-04-18 21:15 ` James Smart
  2017-04-19  2:01 ` Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: James Smart @ 2017-04-18 21:15 UTC (permalink / raw)
  To: Maurizio Lombardi; +Cc: dick.kennedy, linux-scsi, emilne, jejb, martin.petersen



On 4/18/2017 2:55 AM, Maurizio Lombardi wrote:
> This patch fixes a potential buffer overflow in lpfc_nvme_info_show().
>
> Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
> ---
>

looks fine

-- james

Signed-off-by: James Smart <james.smart@broadcom.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] scsi: lpfc: fix potential buffer overflow.
  2017-04-18  9:55 [PATCH] scsi: lpfc: fix potential buffer overflow Maurizio Lombardi
  2017-04-18 15:07 ` Ewan D. Milne
  2017-04-18 21:15 ` James Smart
@ 2017-04-19  2:01 ` Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: Martin K. Petersen @ 2017-04-19  2:01 UTC (permalink / raw)
  To: Maurizio Lombardi
  Cc: james.smart, dick.kennedy, linux-scsi, emilne, jejb,
	martin.petersen

Maurizio Lombardi <mlombard@redhat.com> writes:

> This patch fixes a potential buffer overflow in lpfc_nvme_info_show().

Applied to 4.12/scsi-queue.

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-04-19  2:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-18  9:55 [PATCH] scsi: lpfc: fix potential buffer overflow Maurizio Lombardi
2017-04-18 15:07 ` Ewan D. Milne
2017-04-18 21:15 ` James Smart
2017-04-19  2:01 ` Martin K. Petersen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox