Message ID | 1365437258-31412-2-git-send-email-eduardo.valentin@ti.com (mailing list archive) |
---|---|
State | Superseded, archived |
Delegated to: | Zhang Rui |
Headers | show |
On Mon, 2013-04-08 at 12:07 -0400, Eduardo Valentin wrote: > For memory boundaries safety, use strlcpy instead of strcpy. > > Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com> ACK. thanks, rui > --- > drivers/thermal/thermal_sys.c | 4 ++-- > 1 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/thermal/thermal_sys.c b/drivers/thermal/thermal_sys.c > index 5b7863a..7875607 100644 > --- a/drivers/thermal/thermal_sys.c > +++ b/drivers/thermal/thermal_sys.c > @@ -1289,7 +1289,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; > @@ -1594,7 +1594,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; -- To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/thermal/thermal_sys.c b/drivers/thermal/thermal_sys.c index 5b7863a..7875607 100644 --- a/drivers/thermal/thermal_sys.c +++ b/drivers/thermal/thermal_sys.c @@ -1289,7 +1289,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; @@ -1594,7 +1594,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;
For memory boundaries safety, use strlcpy instead of strcpy. Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com> --- drivers/thermal/thermal_sys.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)