thermal: cpu_cooling: use snprintf instead of sprintf

Limit the amount of bytes written to dev_name by
secure writing with snprintf.

Signed-off-by: Eduardo Valentin <[email protected]>
Acked-by: Amit Daniel Kachhap <[email protected]>
Signed-off-by: Zhang Rui <[email protected]>
This commit is contained in:
Eduardo Valentin 2013-04-17 17:12:17 +00:00 • committed by Zhang Rui
commit 99871a714b

View file

@ -458,7 +458,8 @@ struct thermal_cooling_device *cpufreq_cooling_register(
return ERR_PTR(-EINVAL);
}
sprintf(dev_name, "thermal-cpufreq-%d", cpufreq_dev->id);
snprintf(dev_name, sizeof(dev_name), "thermal-cpufreq-%d",
cpufreq_dev->id);
cool_dev = thermal_cooling_device_register(dev_name, cpufreq_dev,
&cpufreq_cooling_ops);