]> git.karo-electronics.de Git - linux-beck.git/commitdiff
thermal: cpu_cooling: use snprintf instead of sprintf
authorEduardo Valentin <eduardo.valentin@ti.com>
Wed, 17 Apr 2013 17:12:17 +0000 (17:12 +0000)
committerZhang Rui <rui.zhang@intel.com>
Wed, 24 Apr 2013 16:34:43 +0000 (00:34 +0800)
Limit the amount of bytes written to dev_name by
secure writing with snprintf.

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Acked-by: Amit Daniel Kachhap <amit.daniel@samsung.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
drivers/thermal/cpu_cooling.c

index b4161cfce4a8d3dd738fe9e0c87be3ace9b6bd31..a04269de15700e8a4b6550a1c6051cdbba682c35 100644 (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);