All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ARM:mach-msm: seting tail NUL after strncpy
@ 2013-01-30  5:01 ` Chen Gang
  0 siblings, 0 replies; 14+ messages in thread
From: Chen Gang @ 2013-01-30  5:01 UTC (permalink / raw)
  To: davidb, dwalker, bryanh, Russell King - ARM Linux
  Cc: linux-arm-kernel, linux-arm-msm


  temp need NUL terminated, or next ptr may cause issue.

Signed-off-by: Chen Gang <gang.chen@asianux.com>
---
 arch/arm/mach-msm/clock-debug.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm/mach-msm/clock-debug.c
b/arch/arm/mach-msm/clock-debug.c
index 4886404..bdca900 100644
--- a/arch/arm/mach-msm/clock-debug.c
+++ b/arch/arm/mach-msm/clock-debug.c
@@ -105,6 +105,8 @@ int __init clock_debug_add(struct clk *clock)
 		return -ENOMEM;

 	strncpy(temp, clock->dbg_name, ARRAY_SIZE(temp)-1);
+	temp[ARRAY_SIZE(temp)-1] = '\0';
+
 	for (ptr = temp; *ptr; ptr++)
 		*ptr = tolower(*ptr);

-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2013-02-01  1:12 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-30  5:01 [PATCH] ARM:mach-msm: seting tail NUL after strncpy Chen Gang
2013-01-30  5:01 ` Chen Gang
2013-01-30  9:19 ` Bjørn Mork
2013-01-30  9:19   ` Bjørn Mork
2013-01-30 10:46   ` Chen Gang
2013-01-30 10:46     ` Chen Gang
2013-01-30 11:12   ` [PATCH v2] ARM:mach-msm: using strlcpy instead lof strncpy Chen Gang
2013-01-30 11:12     ` Chen Gang
2013-01-30 21:33 ` [PATCH] ARM:mach-msm: seting tail NUL after strncpy David Brown
2013-01-30 21:33   ` David Brown
2013-01-30 21:59   ` Stephen Boyd
2013-01-30 21:59     ` Stephen Boyd
2013-02-01  1:12     ` Chen Gang
2013-02-01  1:12       ` Chen Gang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.