Commit cd554b02 authored by Larry Finger's avatar Larry Finger Committed by Greg Kroah-Hartman

rtl8187: Fix warning generated when strncpy() destination length matches the sixe argument

[ Upstream commit 199ba9fa ]

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: default avatarLarry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent c495a8c7
...@@ -146,7 +146,7 @@ static int rtl8187_register_led(struct ieee80211_hw *dev, ...@@ -146,7 +146,7 @@ static int rtl8187_register_led(struct ieee80211_hw *dev,
led->dev = dev; led->dev = dev;
led->ledpin = ledpin; led->ledpin = ledpin;
led->is_radio = is_radio; 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.name = led->name;
led->led_dev.default_trigger = default_trigger; led->led_dev.default_trigger = default_trigger;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment