From: Eduardo Valentin Date: Tue, 23 Apr 2013 21:48:12 +0000 (+0000) Subject: thermal: use strlcpy instead of strcpy X-Git-Tag: Ubuntu-snapdragon-4.4.0-1029.32~10965^2~6^2~8 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=c7a8b9d91642cb858862de613652aad5d21632be;p=mirror_ubuntu-zesty-kernel.git thermal: use strlcpy instead of strcpy For memory boundaries safety, use strlcpy instead of strcpy. Signed-off-by: Eduardo Valentin Signed-off-by: Zhang Rui --- 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, return ERR_PTR(result); } - strcpy(cdev->type, type ? : ""); + strlcpy(cdev->type, type ? : "", sizeof(cdev->type)); mutex_init(&cdev->lock); INIT_LIST_HEAD(&cdev->thermal_instances); cdev->ops = ops; @@ -1606,7 +1606,7 @@ struct thermal_zone_device *thermal_zone_device_register(const char *type, return ERR_PTR(result); } - strcpy(tz->type, type ? : ""); + strlcpy(tz->type, type ? : "", sizeof(tz->type)); tz->ops = ops; tz->tzp = tzp; tz->device.class = &thermal_class;