* [PATCH] staging: greybus: Replace strncpy with strscpy
@ 2026-08-03 1:26 Noah Techoueyres
0 siblings, 0 replies; only message in thread
From: Noah Techoueyres @ 2026-08-03 1:26 UTC (permalink / raw)
To: johan, elder, gregkh; +Cc: greybus-dev, linux-staging, Noah Techoueyres
Replace deprecated strncpy() with strscpy() to improve string
handling safety. strscpy() guarantees null-termination and is
the preferred function per the kernel string handling guidelines.
Signed-off-by: Noah Techoueyres <noahtechoueyres@gmail.com>
---
drivers/staging/greybus/Documentation/firmware/firmware.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/staging/greybus/Documentation/firmware/firmware.c b/drivers/staging/greybus/Documentation/firmware/firmware.c
index 3b35ef6d4adb..669185706744 100644
--- a/drivers/staging/greybus/Documentation/firmware/firmware.c
+++ b/drivers/staging/greybus/Documentation/firmware/firmware.c
@@ -63,7 +63,7 @@ static int update_intf_firmware(int fd)
intf_load.major = 0;
intf_load.minor = 0;
- strncpy((char *)&intf_load.firmware_tag, firmware_tag,
+ strscpy((char *)&intf_load.firmware_tag, firmware_tag,
GB_FIRMWARE_U_TAG_MAX_SIZE);
ret = ioctl(fd, FW_MGMT_IOC_INTF_LOAD_AND_VALIDATE, &intf_load);
@@ -101,7 +101,7 @@ static int update_backend_firmware(int fd)
/* Get Backend Firmware Version */
printf("Getting Backend Firmware Version\n");
- strncpy((char *)&backend_fw_info.firmware_tag, firmware_tag,
+ strscpy((char *)&backend_fw_info.firmware_tag, firmware_tag,
GB_FIRMWARE_U_TAG_MAX_SIZE);
retry_fw_version:
@@ -129,7 +129,7 @@ static int update_backend_firmware(int fd)
/* Try Backend Firmware Update over Unipro */
printf("Updating Backend Firmware\n");
- strncpy((char *)&backend_update.firmware_tag, firmware_tag,
+ strscpy((char *)&backend_update.firmware_tag, firmware_tag,
GB_FIRMWARE_U_TAG_MAX_SIZE);
retry_fw_update:
--
2.43.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-08-03 1:26 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-03 1:26 [PATCH] staging: greybus: Replace strncpy with strscpy Noah Techoueyres
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox