From: Eduardo Valentin Date: Wed, 17 Apr 2013 17:12:17 +0000 (+0000) Subject: thermal: cpu_cooling: use snprintf instead of sprintf X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=99871a714b0a9429e960629fbc2c6c20c57ea484;p=linux-beck.git 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 Acked-by: Amit Daniel Kachhap Signed-off-by: Zhang Rui --- diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c index b4161cfce4a8..a04269de1570 100644 --- a/drivers/thermal/cpu_cooling.c +++ b/drivers/thermal/cpu_cooling.c @@ -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);