thermal: armada: use strscpy() to instead of strncpy()
Subsystems (2)
PATCH 1/1 thermal: armada: 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]>
--- drivers/thermal/armada_thermal.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/thermal/armada_thermal.c +1 -2
@@ -761,8 +761,7 @@ static void armada_set_sane_name(struct platform_device *pdev, }/* Save the name locally */ -strncpy (priv->zone_name, name,THERMAL_NAME_LENGTH -1 ); - priv->zone_name[THERMAL_NAME_LENGTH -1 ] ='\0' ; +strscpy (priv->zone_name, name,THERMAL_NAME_LENGTH );/* Then check there are no '-' or hwmon core will complain */ do {
Signature · 1 line
2.15.2