DORMANTno replies

[PATCH] arch: arm: mach-msm: using strlcpy instead of strncpy

From: Chen Gang <hidden>
Date: 2013-05-26 06:55:25
Also in: linux-arm-msm
Subsystem: arm port, the rest · Maintainers: Russell King, Linus Torvalds

For NULL terminated string, need always be sure of ended by zero.

Or the next 'ptr' in 'for' looping may cause issue.


Signed-off-by: Chen Gang <redacted>
---
 arch/arm/mach-msm/clock-debug.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/arch/arm/mach-msm/clock-debug.c b/arch/arm/mach-msm/clock-debug.c
index 4886404..b0fbdf1 100644
--- a/arch/arm/mach-msm/clock-debug.c
+++ b/arch/arm/mach-msm/clock-debug.c
@@ -104,7 +104,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.7.6
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help