ath5k: use strscpy() to instead of strncpy()
Subsystems (3)
PATCH 1/1 ath5k: 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.
--- drivers/net/wireless/ath/ath5k/led.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/wireless/ath/ath5k/led.c +1 -2
@@ -131,8 +131,7 @@ ath5k_register_led(struct ath5k_hw *ah, struct ath5k_led *led,int err; led->ah = ah; -strncpy (led->name, name,sizeof (led->name)); - led->name[sizeof (led->name)-1 ] =0 ; +strscpy (led->name, name,sizeof (led->name)); led->led_dev.name = led->name; led->led_dev.default_trigger = trigger; led->led_dev.brightness_set = ath5k_led_brightness_set;
Signature · 1 line
2.15.2
Luis Chamberlain
maintainerQuoted 4 lines · On Fri, Dec 23, 2022 at 10:34:45AM +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.
According to who? Are you sure you are not just sending stupid commits to get an increase in your kernel commit count? Because this is an old driver and who cares?
Luis
Quoted 3 lines
According to who? Are you sure you are not just sending stupid commits to get an increase in your kernel commit count? Because this is an old driver and who cares?
This is suggested by Petr Mladek, please see:
https://lore.kernel.org/all/Y4cz27AbZVVd9pLJ@alley/
And if the driver no one cares, we may stop modify it.