From: gang.chen@asianux•com (Chen Gang)
To: linux-arm-kernel@lists•infradead.org
Subject: [PATCH v2] ARM:mach-msm: using strlcpy instead lof strncpy
Date: Wed, 30 Jan 2013 19:12:51 +0800 [thread overview]
Message-ID: <51090033.80004@asianux.com> (raw)
In-Reply-To: <87pq0nni3v.fsf@nemi.mork.no>
The fields must be null-terminated, or next ptr, will cause issue
Signed-off-by: Chen Gang <gang.chen@asianux•com>
---
arch/arm/mach-msm/clock-debug.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/arm/mach-msm/clock-debug.c b/arch/arm/mach-msm/clock-debug.c
index 4886404..c40dcaf 100644
--- a/arch/arm/mach-msm/clock-debug.c
+++ b/arch/arm/mach-msm/clock-debug.c
@@ -17,6 +17,7 @@
#include <linux/module.h>
#include <linux/ctype.h>
#include <linux/debugfs.h>
+#include <linux/string.h>
#include <linux/clk.h>
#include "clock.h"
@@ -104,7 +105,7 @@ int __init clock_debug_add(struct clk *clock)
if (!debugfs_base)
return -ENOMEM;
- strncpy(temp, clock->dbg_name, ARRAY_SIZE(temp)-1);
+ strlcpy(temp, clock->dbg_name, ARRAY_SIZE(temp));
for (ptr = temp; *ptr; ptr++)
*ptr = tolower(*ptr);
--
1.7.10.4
next prev parent reply other threads:[~2013-01-30 11:12 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-30 5:01 [PATCH] ARM:mach-msm: seting tail NUL after strncpy Chen Gang
2013-01-30 9:19 ` Bjørn Mork
2013-01-30 10:46 ` Chen Gang
2013-01-30 11:12 ` Chen Gang [this message]
2013-01-30 21:33 ` David Brown
2013-01-30 21:59 ` Stephen Boyd
2013-02-01 1:12 ` Chen Gang
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=51090033.80004@asianux.com \
--to=gang.chen@asianux$(echo .)com \
--cc=linux-arm-kernel@lists$(echo .)infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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