lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250413190238.2cb8ec64@pumpkin>
Date: Sun, 13 Apr 2025 19:02:38 +0100
From: David Laight <david.laight.linux@...il.com>
To: Daniel Wagner <wagi@...nel.org>
Cc: James Smart <james.smart@...adcom.com>, Dick Kennedy
 <dick.kennedy@...adcom.com>, "James E.J. Bottomley"
 <James.Bottomley@...senPartnership.com>, "Martin K. Petersen"
 <martin.petersen@...cle.com>, linux-scsi@...r.kernel.org,
 linux-kernel@...r.kernel.org
Subject: Re: [PATCH] lpfc: use memcpy for bios version

On Wed, 09 Apr 2025 13:34:22 +0200
Daniel Wagner <wagi@...nel.org> wrote:

> 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 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@...nel.org>
> ---
>  drivers/scsi/lpfc/lpfc_sli.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
> index 6574f9e744766d49e245bd648667cc3ffc45289e..a335d34070d3c5fa4778bb1cb0eef797c7194f3b 100644
> --- a/drivers/scsi/lpfc/lpfc_sli.c
> +++ b/drivers/scsi/lpfc/lpfc_sli.c
> @@ -6003,9 +6003,9 @@ lpfc_sli4_get_ctl_attr(struct lpfc_hba *phba)
>  	phba->sli4_hba.flash_id = bf_get(lpfc_cntl_attr_flash_id, cntl_attr);
>  	phba->sli4_hba.asic_rev = bf_get(lpfc_cntl_attr_asic_rev, cntl_attr);
>  
> -	memset(phba->BIOSVersion, 0, sizeof(phba->BIOSVersion));
> -	strlcat(phba->BIOSVersion, (char *)cntl_attr->bios_ver_str,
> +	memcpy(phba->BIOSVersion, cntl_attr->bios_ver_str,
>  		sizeof(phba->BIOSVersion));
> +	phba->BIOSVersion[sizeof(phba->BIOSVersion) - 1] = '\0';

Isn't that just strscpy() ?

	David

>  
>  	lpfc_printf_log(phba, KERN_INFO, LOG_SLI,
>  			"3086 lnk_type:%d, lnk_numb:%d, bios_ver:%s, "
> 
> ---
> base-commit: 0af2f6be1b4281385b618cb86ad946eded089ac8
> change-id: 20250409-fix-lpfc-bios-str-330f6a9d892f
> 
> Best regards,


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ