public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] scsi: fnic: Remove unnecessary NUL-terminations
@ 2025-03-14 22:16 Thorsten Blum
  2025-03-18  1:48 ` Karan Tilak Kumar (kartilak)
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Thorsten Blum @ 2025-03-14 22:16 UTC (permalink / raw)
  To: Satish Kharat, Sesidhar Baddela, Karan Tilak Kumar,
	James E.J. Bottomley, Martin K. Petersen
  Cc: Thorsten Blum, linux-scsi, linux-kernel

strscpy_pad() already NUL-terminates 'data' at the corresponding
indexes. Remove any unnecessary NUL-terminations.

No functional changes intended.

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
 drivers/scsi/fnic/fdls_disc.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/scsi/fnic/fdls_disc.c b/drivers/scsi/fnic/fdls_disc.c
index 11211c469583..7294645ed6d2 100644
--- a/drivers/scsi/fnic/fdls_disc.c
+++ b/drivers/scsi/fnic/fdls_disc.c
@@ -1898,7 +1898,6 @@ static void fdls_fdmi_register_hba(struct fnic_iport_s *iport)
 	if (fnic->subsys_desc_len >= FNIC_FDMI_MODEL_LEN)
 		fnic->subsys_desc_len = FNIC_FDMI_MODEL_LEN - 1;
 	strscpy_pad(data, fnic->subsys_desc, FNIC_FDMI_MODEL_LEN);
-	data[FNIC_FDMI_MODEL_LEN - 1] = 0;
 	fnic_fdmi_attr_set(fdmi_attr, FNIC_FDMI_TYPE_MODEL, FNIC_FDMI_MODEL_LEN,
 		data, &attr_off_bytes);
 
@@ -2061,7 +2060,6 @@ static void fdls_fdmi_register_pa(struct fnic_iport_s *iport)
 	snprintf(tmp_data, FNIC_FDMI_OS_NAME_LEN - 1, "host%d",
 		 fnic->host->host_no);
 	strscpy_pad(data, tmp_data, FNIC_FDMI_OS_NAME_LEN);
-	data[FNIC_FDMI_OS_NAME_LEN - 1] = 0;
 	fnic_fdmi_attr_set(fdmi_attr, FNIC_FDMI_TYPE_OS_NAME,
 		FNIC_FDMI_OS_NAME_LEN, data, &attr_off_bytes);
 
@@ -2071,7 +2069,6 @@ static void fdls_fdmi_register_pa(struct fnic_iport_s *iport)
 	sprintf(fc_host_system_hostname(fnic->host), "%s", utsname()->nodename);
 	strscpy_pad(data, fc_host_system_hostname(fnic->host),
 					FNIC_FDMI_HN_LEN);
-	data[FNIC_FDMI_HN_LEN - 1] = 0;
 	fnic_fdmi_attr_set(fdmi_attr, FNIC_FDMI_TYPE_HOST_NAME,
 		FNIC_FDMI_HN_LEN, data, &attr_off_bytes);
 
-- 
2.48.1


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

* RE: [PATCH] scsi: fnic: Remove unnecessary NUL-terminations
  2025-03-14 22:16 [PATCH] scsi: fnic: Remove unnecessary NUL-terminations Thorsten Blum
@ 2025-03-18  1:48 ` Karan Tilak Kumar (kartilak)
  2025-03-18  2:04 ` Martin K. Petersen
  2025-03-21  0:36 ` Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: Karan Tilak Kumar (kartilak) @ 2025-03-18  1:48 UTC (permalink / raw)
  To: Thorsten Blum, Satish Kharat (satishkh),
	Sesidhar Baddela (sebaddel), James E.J. Bottomley,
	Martin K. Petersen
  Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org

On Friday, March 14, 2025 3:16 PM, Thorsten Blum <thorsten.blum@linux.dev> wrote:
>
> strscpy_pad() already NUL-terminates 'data' at the corresponding
> indexes. Remove any unnecessary NUL-terminations.
>
> No functional changes intended.
>
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
> ---
> drivers/scsi/fnic/fdls_disc.c | 3 ---
> 1 file changed, 3 deletions(-)
>
> diff --git a/drivers/scsi/fnic/fdls_disc.c b/drivers/scsi/fnic/fdls_disc.c
> index 11211c469583..7294645ed6d2 100644
> --- a/drivers/scsi/fnic/fdls_disc.c
> +++ b/drivers/scsi/fnic/fdls_disc.c
> @@ -1898,7 +1898,6 @@ static void fdls_fdmi_register_hba(struct fnic_iport_s *iport)
> if (fnic->subsys_desc_len >= FNIC_FDMI_MODEL_LEN)
> fnic->subsys_desc_len = FNIC_FDMI_MODEL_LEN - 1;
> strscpy_pad(data, fnic->subsys_desc, FNIC_FDMI_MODEL_LEN);
> -     data[FNIC_FDMI_MODEL_LEN - 1] = 0;
> fnic_fdmi_attr_set(fdmi_attr, FNIC_FDMI_TYPE_MODEL, FNIC_FDMI_MODEL_LEN,
> data, &attr_off_bytes);
>
> @@ -2061,7 +2060,6 @@ static void fdls_fdmi_register_pa(struct fnic_iport_s *iport)
> snprintf(tmp_data, FNIC_FDMI_OS_NAME_LEN - 1, "host%d",
> fnic->host->host_no);
> strscpy_pad(data, tmp_data, FNIC_FDMI_OS_NAME_LEN);
> -     data[FNIC_FDMI_OS_NAME_LEN - 1] = 0;
> fnic_fdmi_attr_set(fdmi_attr, FNIC_FDMI_TYPE_OS_NAME,
> FNIC_FDMI_OS_NAME_LEN, data, &attr_off_bytes);
>
> @@ -2071,7 +2069,6 @@ static void fdls_fdmi_register_pa(struct fnic_iport_s *iport)
> sprintf(fc_host_system_hostname(fnic->host), "%s", utsname()->nodename);
> strscpy_pad(data, fc_host_system_hostname(fnic->host),
> FNIC_FDMI_HN_LEN);
> -     data[FNIC_FDMI_HN_LEN - 1] = 0;
> fnic_fdmi_attr_set(fdmi_attr, FNIC_FDMI_TYPE_HOST_NAME,
> FNIC_FDMI_HN_LEN, data, &attr_off_bytes);
>
> --
> 2.48.1
>
>

Looks good to me.

Reviewed-by: Karan Tilak Kumar <kartilak@cisco.com>

Regards,
Karan

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

* Re: [PATCH] scsi: fnic: Remove unnecessary NUL-terminations
  2025-03-14 22:16 [PATCH] scsi: fnic: Remove unnecessary NUL-terminations Thorsten Blum
  2025-03-18  1:48 ` Karan Tilak Kumar (kartilak)
@ 2025-03-18  2:04 ` Martin K. Petersen
  2025-03-21  0:36 ` Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: Martin K. Petersen @ 2025-03-18  2:04 UTC (permalink / raw)
  To: Thorsten Blum
  Cc: Satish Kharat, Sesidhar Baddela, Karan Tilak Kumar,
	James E.J. Bottomley, Martin K. Petersen, linux-scsi,
	linux-kernel


Thorsten,

> strscpy_pad() already NUL-terminates 'data' at the corresponding
> indexes. Remove any unnecessary NUL-terminations.

Applied to 6.15/scsi-staging, thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

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

* Re: [PATCH] scsi: fnic: Remove unnecessary NUL-terminations
  2025-03-14 22:16 [PATCH] scsi: fnic: Remove unnecessary NUL-terminations Thorsten Blum
  2025-03-18  1:48 ` Karan Tilak Kumar (kartilak)
  2025-03-18  2:04 ` Martin K. Petersen
@ 2025-03-21  0:36 ` Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: Martin K. Petersen @ 2025-03-21  0:36 UTC (permalink / raw)
  To: Satish Kharat, Sesidhar Baddela, Karan Tilak Kumar,
	James E.J. Bottomley, Thorsten Blum
  Cc: Martin K . Petersen, linux-scsi, linux-kernel

On Fri, 14 Mar 2025 23:16:26 +0100, Thorsten Blum wrote:

> strscpy_pad() already NUL-terminates 'data' at the corresponding
> indexes. Remove any unnecessary NUL-terminations.
> 
> No functional changes intended.
> 
> 

Applied to 6.15/scsi-queue, thanks!

[1/1] scsi: fnic: Remove unnecessary NUL-terminations
      https://git.kernel.org/mkp/scsi/c/bd067766ee2a

-- 
Martin K. Petersen	Oracle Linux Engineering

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

end of thread, other threads:[~2025-03-21  0:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-14 22:16 [PATCH] scsi: fnic: Remove unnecessary NUL-terminations Thorsten Blum
2025-03-18  1:48 ` Karan Tilak Kumar (kartilak)
2025-03-18  2:04 ` Martin K. Petersen
2025-03-21  0:36 ` 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