staging: greybus: Replace strncpy with strscpy
PATCH 1/1 staging: greybus: Replace strncpy with strscpy
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 <[email protected]>
--- drivers/staging/greybus/Documentation/firmware/firmware.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/greybus/Documentation/firmware/firmware.c +3 -3
@@ -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:
Signature · 1 line
2.43.0
Quoted 3 lines · Noah Techoueyres
Replace deprecated
strncpy()withstrscpy()to improve string
handling safety.strscpy()guarantees null-termination and is the preferred function per the kernel string handling guidelines.
This white space is weird. You did't try to compile your patch.
regards,
dan carpenter