Thread (3 messages) read the whole thread 3 messages, 2 authors, 2013-01-30
DORMANTno replies

[PATCH v2] ARM:mach-msm: using strlcpy instead lof strncpy

From: Chen Gang <hidden>
Date: 2013-01-30 11:12:57
Also in: linux-arm-msm
Subsystem: arm port, the rest · Maintainers: Russell King, Linus Torvalds

  The fields must be null-terminated, or next ptr, will cause issue

Signed-off-by: Chen Gang <redacted>
---
 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help