提交 c7a8b9d9 编写于 作者: E Eduardo Valentin 提交者: Zhang Rui

thermal: use strlcpy instead of strcpy

For memory boundaries safety, use strlcpy instead of strcpy.
Signed-off-by: NEduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: NZhang Rui <rui.zhang@intel.com>
上级 335553ce
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册