From patchwork Fri Mar 22 21:00:44 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Valentin X-Patchwork-Id: 2322511 X-Patchwork-Delegate: rui.zhang@intel.com Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id B2DD53FD8C for ; Fri, 22 Mar 2013 21:02:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1423087Ab3CVVBl (ORCPT ); Fri, 22 Mar 2013 17:01:41 -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 Received: from dlelxv30.itg.ti.com ([172.17.2.17]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id r2ML1dGd005851; Fri, 22 Mar 2013 16:01:39 -0500 Received: from DFLE72.ent.ti.com (dfle72.ent.ti.com [128.247.5.109]) by dlelxv30.itg.ti.com (8.13.8/8.13.8) with ESMTP id r2ML1dqx005311; Fri, 22 Mar 2013 16:01:39 -0500 Received: from dlelxv24.itg.ti.com (172.17.1.199) by DFLE72.ent.ti.com (128.247.5.109) with Microsoft SMTP Server id 14.2.342.3; Fri, 22 Mar 2013 16:01:39 -0500 Received: from legion.dal.design.ti.com (legion.dal.design.ti.com [128.247.22.53]) by dlelxv24.itg.ti.com (8.13.8/8.13.8) with ESMTP id r2ML1dHa021368; Fri, 22 Mar 2013 16:01:39 -0500 Received: from localhost (h68-18.vpn.ti.com [172.24.68.18]) by legion.dal.design.ti.com (8.11.7p1+Sun/8.11.7) with ESMTP id r2ML1aV08921; Fri, 22 Mar 2013 16:01:37 -0500 (CDT) 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 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@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;