Skip to content

Commit 714a753

Browse files
committed
scsi: lpfc: Use memcpy() for BIOS version
jira VULN-72452 cve CVE-2025-38332 commit-author Daniel Wagner <wagi@kernel.org> commit ae82eaf The strlcat() with FORTIFY support is triggering a panic because it thinks the target buffer will overflow although the correct target buffer size is passed in. Anyway, instead of memset() with 0 followed by a strlcat(), just use memcpy() and ensure that the resulting buffer is NULL terminated. BIOSVersion is only used for the lpfc_printf_log() which expects a properly terminated string. Signed-off-by: Daniel Wagner <wagi@kernel.org> Link: https://lore.kernel.org/r/20250409-fix-lpfc-bios-str-v1-1-05dac9e51e13@kernel.org Reviewed-by: Justin Tee <justin.tee@broadcom.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> (cherry picked from commit ae82eaf) Signed-off-by: Brett Mastbergen <bmastbergen@ciq.com>
1 parent bc5ef8e commit 714a753

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/scsi/lpfc/lpfc_sli.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5441,9 +5441,9 @@ lpfc_sli4_get_ctl_attr(struct lpfc_hba *phba)
54415441
phba->sli4_hba.lnk_info.lnk_no =
54425442
bf_get(lpfc_cntl_attr_lnk_numb, cntl_attr);
54435443

5444-
memset(phba->BIOSVersion, 0, sizeof(phba->BIOSVersion));
5445-
strlcat(phba->BIOSVersion, (char *)cntl_attr->bios_ver_str,
5444+
memcpy(phba->BIOSVersion, cntl_attr->bios_ver_str,
54465445
sizeof(phba->BIOSVersion));
5446+
phba->BIOSVersion[sizeof(phba->BIOSVersion) - 1] = '\0';
54475447

54485448
lpfc_printf_log(phba, KERN_INFO, LOG_SLI,
54495449
"3086 lnk_type:%d, lnk_numb:%d, bios_ver:%s\n",

0 commit comments

Comments
 (0)