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>
This commit is contained in:
Eduardo Valentin 2013-04-23 21:48:12 +00:00 committed by Zhang Rui
parent 335553ce40
commit c7a8b9d916
1 changed files with 2 additions and 2 deletions

View File

@ -1301,7 +1301,7 @@ thermal_cooling_device_register(char *type, void *devdata,
return ERR_PTR(result); return ERR_PTR(result);
} }
strcpy(cdev->type, type ? : ""); strlcpy(cdev->type, type ? : "", sizeof(cdev->type));
mutex_init(&cdev->lock); mutex_init(&cdev->lock);
INIT_LIST_HEAD(&cdev->thermal_instances); INIT_LIST_HEAD(&cdev->thermal_instances);
cdev->ops = ops; cdev->ops = ops;
@ -1606,7 +1606,7 @@ struct thermal_zone_device *thermal_zone_device_register(const char *type,
return ERR_PTR(result); return ERR_PTR(result);
} }
strcpy(tz->type, type ? : ""); strlcpy(tz->type, type ? : "", sizeof(tz->type));
tz->ops = ops; tz->ops = ops;
tz->tzp = tzp; tz->tzp = tzp;
tz->device.class = &thermal_class; tz->device.class = &thermal_class;