linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eduardo Valentin <eduardo.valentin@ti.com>
To: rui.zhang@intel.com
Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
	Eduardo Valentin <eduardo.valentin@ti.com>
Subject: [PATCHv2 1/9] thermal: use strlcpy instead of strcpy
Date: Tue, 23 Apr 2013 17:48:12 -0400	[thread overview]
Message-ID: <1366753700-1412-2-git-send-email-eduardo.valentin@ti.com> (raw)
In-Reply-To: <1366753700-1412-1-git-send-email-eduardo.valentin@ti.com>

For memory boundaries safety, use strlcpy instead of strcpy.

Acked-by: Zhang Rui <rui.zhang@intel.com>
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
---
 drivers/thermal/thermal_core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
index 4cdc3e3..bea3884 100644
--- a/drivers/thermal/thermal_core.c
+++ b/drivers/thermal/thermal_core.c
@@ -1287,7 +1287,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;
@@ -1592,7 +1592,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.8.2.1.342.gfa7285d


  reply	other threads:[~2013-04-23 21:49 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-23 21:48 [PATCHv2 0/9] thermal: clean ups on thermal code base Eduardo Valentin
2013-04-23 21:48 ` Eduardo Valentin [this message]
2013-04-23 21:48 ` [PATCHv2 2/9] thermal: update driver license Eduardo Valentin
2013-04-23 21:48 ` [PATCHv2 3/9] thermal: rename notify_thermal_framework to thermal_notify_framework Eduardo Valentin
2013-04-23 21:48 ` [PATCHv2 4/9] thermal: use EXPORT_SYMBOL_GPL Eduardo Valentin
2013-04-23 21:48 ` [PATCHv2 5/9] thermal: update kernel-doc for thermal_zone_bind_cooling_device Eduardo Valentin
2013-04-23 21:48 ` [PATCHv2 6/9] thermal: update kernel-doc for thermal_zone_unbind_cooling_device Eduardo Valentin
2013-04-23 21:48 ` [PATCHv2 7/9] thermal: update kernel-doc for thermal_cooling_device_register Eduardo Valentin
2013-04-23 21:48 ` [PATCHv2 8/9] thermal: update kernel-doc for create_trip_attrs Eduardo Valentin
2013-04-23 21:48 ` [PATCHv2 9/9] thermal: update kernel-doc for thermal_zone_device_register Eduardo Valentin
2013-04-24 16:54 ` [PATCHv2 0/9] thermal: clean ups on thermal code base Zhang, Rui

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1366753700-1412-2-git-send-email-eduardo.valentin@ti.com \
    --to=eduardo.valentin@ti.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rui.zhang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).