Skip to contentSkip to conversation

kernel: trace: ftrace: strncpy, using strlcpy instead of strncpy

PATCH In review Chen Gang 4 participants 5 messages Apr 8, 2013 – Apr 10, 2013

Subsystems (2)
lore
Share & tools
lore

Chen Gang

author
#0 lore raw

PATCH 1/1 kernel: trace: ftrace: strncpy, using strlcpy instead of strncpy

for NUL terminated string, need always set '\0' at the end.

---
 kernel/trace/ftrace.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
kernel/trace/ftrace.c +2 -2
index dfd33f0..fa984b7 100644
@@ -3492,14 +3492,14 @@ static char ftrace_filter_buf[FTRACE_FILTER_SIZE] __initdata;
 
 static int __init set_ftrace_notrace(char *str)
 {
-	strncpy(ftrace_notrace_buf, str, FTRACE_FILTER_SIZE);
+	strlcpy(ftrace_notrace_buf, str, FTRACE_FILTER_SIZE);
 	return 1;
 }
 __setup("ftrace_notrace=", set_ftrace_notrace);
 
 static int __init set_ftrace_filter(char *str)
 {
-	strncpy(ftrace_filter_buf, str, FTRACE_FILTER_SIZE);
+	strlcpy(ftrace_filter_buf, str, FTRACE_FILTER_SIZE);
 	return 1;
 }
 __setup("ftrace_filter=", set_ftrace_filter);
Signature · 1 line
1.7.7.6
#1 lore raw

[tip:perf/urgent] ftrace: Fix strncpy() use, use strlcpy() instead of strncpy()

ftrace: Fix strncpy() use, use strlcpy() instead of strncpy()
Commit-ID:  75761cc15877c155b3849b4e0e0cb3f897faf471
Gitweb:     http://git.kernel.org/tip/75761cc15877c155b3849b4e0e0cb3f897faf471
Author:     Chen Gang <[email protected]>
AuthorDate: Mon, 8 Apr 2013 12:12:39 +0800
Committer:  Ingo Molnar <[email protected]>
CommitDate: Mon, 8 Apr 2013 13:26:56 +0200

ftrace: Fix strncpy() use, use strlcpy() instead of strncpy()

For NUL terminated string we always need to set '\0' at the end.

---
 kernel/trace/ftrace.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/trace/ftrace.c +2 -2
index 6893d5a..db14374 100644
@@ -3441,14 +3441,14 @@ static char ftrace_filter_buf[FTRACE_FILTER_SIZE] __initdata;
 
 static int __init set_ftrace_notrace(char *str)
 {
-	strncpy(ftrace_notrace_buf, str, FTRACE_FILTER_SIZE);
+	strlcpy(ftrace_notrace_buf, str, FTRACE_FILTER_SIZE);
 	return 1;
 }
 __setup("ftrace_notrace=", set_ftrace_notrace);
 
 static int __init set_ftrace_filter(char *str)
 {
-	strncpy(ftrace_filter_buf, str, FTRACE_FILTER_SIZE);
+	strlcpy(ftrace_filter_buf, str, FTRACE_FILTER_SIZE);
 	return 1;
 }
 __setup("ftrace_filter=", set_ftrace_filter);
author
#2 lore raw

Re: [tip:perf/urgent] ftrace: Fix strncpy() use, use strlcpy() instead of strncpy()

Quoted 9 lines · tip-bot for Chen Gang
Commit-ID:  75761cc15877c155b3849b4e0e0cb3f897faf471
Gitweb:     http://git.kernel.org/tip/75761cc15877c155b3849b4e0e0cb3f897faf471
Author:     Chen Gang <[email protected]>
AuthorDate: Mon, 8 Apr 2013 12:12:39 +0800
Committer:  Ingo Molnar <[email protected]>
CommitDate: Mon, 8 Apr 2013 13:26:56 +0200

ftrace: Fix strncpy() use, use strlcpy() instead of strncpy()

Quoted 8 lines

For NUL terminated string we always need to set '\0' at the end.

---

thank you very much for applying the 3 related patches.

Signature · 3 lines
Chen Gang

Asianux Corporation
maintainer
#3 lore raw
In reply to Chen Gang

I'll queue this up for my 3.10 queue. I'm going to merge this patch with the previous patch you sent that updates trace.c

Thanks,

-- Steve

Quoted 28 lines · Chen Gang

for NUL terminated string, need always set '\0' at the end.

---
 kernel/trace/ftrace.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
kernel/trace/ftrace.c +2 -2
index dfd33f0..fa984b7 100644
@@ -3492,14 +3492,14 @@ static char ftrace_filter_buf[FTRACE_FILTER_SIZE] __initdata;
 
 static int __init set_ftrace_notrace(char *str)
 {
-	strncpy(ftrace_notrace_buf, str, FTRACE_FILTER_SIZE);
+	strlcpy(ftrace_notrace_buf, str, FTRACE_FILTER_SIZE);
 	return 1;
 }
 __setup("ftrace_notrace=", set_ftrace_notrace);
 
 static int __init set_ftrace_filter(char *str)
 {
-	strncpy(ftrace_filter_buf, str, FTRACE_FILTER_SIZE);
+	strlcpy(ftrace_filter_buf, str, FTRACE_FILTER_SIZE);
 	return 1;
 }
 __setup("ftrace_filter=", set_ftrace_filter);
#4 lore raw
Quoted 6 lines · Steven Rostedt

I'll queue this up for my 3.10 queue. I'm going to merge this patch with the previous patch you sent that updates trace.c

Thanks,

-- Steve

thanks too.

Signature · 3 lines
Chen Gang

Flying Transformer