diff options
author | Eduardo Valentin <eduardo.valentin@ti.com> | 2013-04-23 17:48:12 -0400 |
---|---|---|
committer | Zhang Rui <rui.zhang@intel.com> | 2013-04-24 12:56:07 -0400 |
commit | c7a8b9d91642cb858862de613652aad5d21632be (patch) | |
tree | 6e12ebe7c275762e2104f5511472a53aa2a0e77f /drivers/thermal | |
parent | 335553ce40f0e551383482ad6b0b0eba87f4f218 (diff) |
thermal: use strlcpy instead of strcpy
For memory boundaries safety, use strlcpy instead of strcpy.
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Diffstat (limited to 'drivers/thermal')
-rw-r--r-- | drivers/thermal/thermal_core.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index c0779adb2459..768ad312ba29 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c | |||
@@ -1301,7 +1301,7 @@ thermal_cooling_device_register(char *type, void *devdata, | |||
1301 | return ERR_PTR(result); | 1301 | return ERR_PTR(result); |
1302 | } | 1302 | } |
1303 | 1303 | ||
1304 | strcpy(cdev->type, type ? : ""); | 1304 | strlcpy(cdev->type, type ? : "", sizeof(cdev->type)); |
1305 | mutex_init(&cdev->lock); | 1305 | mutex_init(&cdev->lock); |
1306 | INIT_LIST_HEAD(&cdev->thermal_instances); | 1306 | INIT_LIST_HEAD(&cdev->thermal_instances); |
1307 | cdev->ops = ops; | 1307 | cdev->ops = ops; |
@@ -1606,7 +1606,7 @@ struct thermal_zone_device *thermal_zone_device_register(const char *type, | |||
1606 | return ERR_PTR(result); | 1606 | return ERR_PTR(result); |
1607 | } | 1607 | } |
1608 | 1608 | ||
1609 | strcpy(tz->type, type ? : ""); | 1609 | strlcpy(tz->type, type ? : "", sizeof(tz->type)); |
1610 | tz->ops = ops; | 1610 | tz->ops = ops; |
1611 | tz->tzp = tzp; | 1611 | tz->tzp = tzp; |
1612 | tz->device.class = &thermal_class; | 1612 | tz->device.class = &thermal_class; |