wl18xx: use strscpy() to instead of strncpy()
Subsystems (3)
PATCH v2 1/1 wl18xx: use strscpy() to instead of strncpy()
From: Xu Panda <[email protected]>
The implementation of strscpy() is more robust and safer. That's now the recommended way to copy NUL-terminated strings.
Signed-off-by Xu Panda <[email protected]>
Signed-off-by Yang Yang <[email protected]>
---
change for v2
- use the right tag of wireless-next.
--- drivers/net/wireless/ti/wl18xx/main.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/net/wireless/ti/wl18xx/main.c +1 -4
@@ -1516,12 +1516,9 @@ static int wl18xx_handle_static_data(struct wl1271 *wl,struct wl18xx_static_data_priv *static_data_priv = (struct wl18xx_static_data_priv *) static_data->priv; -strncpy (wl->chip.phy_fw_ver_str, static_data_priv->phy_version, +strscpy (wl->chip.phy_fw_ver_str, static_data_priv->phy_version,sizeof (wl->chip.phy_fw_ver_str)); -/* make sure the string is NULL-terminated */ - wl->chip.phy_fw_ver_str[sizeof (wl->chip.phy_fw_ver_str) -1 ] ='\0' ; -wl1271_info ("PHY firmware version: %s" , static_data_priv->phy_version);return 0 ;
Signature · 1 line
2.15.2
Quoted 10 lines · On Mon, Dec 26, 2022 at 07:14:06PM +0800, [email protected] wrote:
From: Xu Panda <[email protected]>
The implementation of
strscpy()is more robust and safer. That's now the recommended way to copy NUL-terminated strings.Signed-off-by Xu Panda <[email protected]>Signed-off-by Yang Yang <[email protected]>---
change for v2
- use the right tag of wireless-next.
Reviewed-by Simon Horman <[email protected]>