From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1423098Ab3CVVBm (ORCPT ); Fri, 22 Mar 2013 17:01:42 -0400 Received: from devils.ext.ti.com ([198.47.26.153]:34472 "EHLO devils.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1423027Ab3CVVBk (ORCPT ); Fri, 22 Mar 2013 17:01:40 -0400 From: Eduardo Valentin To: Zhang Rui CC: , , Eduardo Valentin Subject: [PATCH 01/11] thermal: use strlcpy instead of strcpy Date: Fri, 22 Mar 2013 17:00:44 -0400 Message-ID: <1363986054-24637-2-git-send-email-eduardo.valentin@ti.com> X-Mailer: git-send-email 1.7.7.1.488.ge8e1c In-Reply-To: <1363986054-24637-1-git-send-email-eduardo.valentin@ti.com> References: <1363986054-24637-1-git-send-email-eduardo.valentin@ti.com> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org For memory boundaries safety, use strlcpy instead of strcpy. Signed-off-by: Eduardo Valentin --- 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; -- 1.7.7.1.488.ge8e1c