scsi: lpfc: fix sprintf() overflow in lpfc_display_fpin_wwpn()
Subsystems (3)
PATCH 1/1 scsi: lpfc: fix sprintf() overflow in lpfc_display_fpin_wwpn()
This scnprintf() uses the wrong limit. It should be "LPFC_FPIN_WWPN_LINE_SZ - len" instead of LPFC_FPIN_WWPN_LINE_SZ.
Fixes 428569e66fa7 ("scsi: lpfc: Expand FPIN and RDF receive logging")
Signed-off-by Dan Carpenter <[email protected]>
--- drivers/scsi/lpfc/lpfc_els.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/lpfc/lpfc_els.c +1 -1
@@ -9387,7 +9387,7 @@ lpfc_display_fpin_wwpn(struct lpfc_hba *phba, __be64 *wwnlist, u32 cnt)/* Extract the next WWPN from the payload */ wwn = *wwnlist++; wwpn =be64_to_cpu (wwn); - len +=scnprintf (buf + len,LPFC_FPIN_WWPN_LINE_SZ , + len +=scnprintf (buf + len,LPFC_FPIN_WWPN_LINE_SZ - len," %016llx" , wwpn);/* Log a message if we are on the last WWPN
Signature · 1 line
2.20.1
Quoted 9 lines · Dan Carpenter
This
scnprintf()uses the wrong limit. It should be "LPFC_FPIN_WWPN_LINE_SZ- len" instead ofLPFC_FPIN_WWPN_LINE_SZ.Fixes 428569e66fa7 ("scsi: lpfc: Expand FPIN and RDF receive logging")Signed-off-by Dan Carpenter <[email protected]>--- drivers/scsi/lpfc/lpfc_els.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
looks good. Thank you
Reviewed-by James Smart <[email protected]>
-- james
Martin K. Petersen
AppliedQuoted 4 lines · Dan Carpenter
This
scnprintf()uses the wrong limit. It should be "LPFC_FPIN_WWPN_LINE_SZ- len" instead ofLPFC_FPIN_WWPN_LINE_SZ.
Applied to 5.15/scsi-fixes, thanks!
[1/1] scsi: lpfc: fix sprintf() overflow in lpfc_display_fpin_wwpn()
https://git.kernel.org/mkp/scsi/c/cdbc16c552f2
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering