rtl8187: Fix warning generated when strncpy() destination length matches the sixe...
authorLarry Finger <Larry.Finger@lwfinger.net>
Mon, 20 Aug 2018 18:48:31 +0000 (13:48 -0500)
committerKalle Valo <kvalo@codeaurora.org>
Fri, 31 Aug 2018 15:46:19 +0000 (18:46 +0300)
In gcc8, when the 3rd argument (size) of a call to strncpy() matches the
length of the first argument, the compiler warns of the possibility of an
unterminated string. Using strlcpy() forces a null at the end.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/realtek/rtl818x/rtl8187/leds.c

index c2d5b49..c089540 100644 (file)
@@ -146,7 +146,7 @@ static int rtl8187_register_led(struct ieee80211_hw *dev,
        led->dev = dev;
        led->ledpin = ledpin;
        led->is_radio = is_radio;
-       strncpy(led->name, name, sizeof(led->name));
+       strlcpy(led->name, name, sizeof(led->name));
 
        led->led_dev.name = led->name;
        led->led_dev.default_trigger = default_trigger;