2013-04-08 04:13:10

by Chen Gang

[permalink] [raw]
Subject: [PATCH] kernel: trace: ftrace: strncpy, using strlcpy instead of strncpy


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

Signed-off-by: Chen Gang <[email protected]>
---
kernel/trace/ftrace.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index dfd33f0..fa984b7 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -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);
--
1.7.7.6


Subject: [tip:perf/urgent] 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.

Signed-off-by: Chen Gang <[email protected]>
Cc: [email protected]
Cc: Frederic Weisbecker <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Ingo Molnar <[email protected]>
---
kernel/trace/ftrace.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 6893d5a..db14374 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -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);

2013-04-09 01:38:46

by Chen Gang

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

On 2013年04月08日 23:31, tip-bot for Chen Gang wrote:
> 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.
>
> Signed-off-by: Chen Gang <[email protected]>
> Cc: [email protected]
> Cc: Frederic Weisbecker <[email protected]>
> Link: http://lkml.kernel.org/r/[email protected]
> Signed-off-by: Ingo Molnar <[email protected]>
> ---


thank you very much for applying the 3 related patches.



--
Chen Gang

Asianux Corporation

2013-04-09 15:00:29

by Steven Rostedt

[permalink] [raw]
Subject: Re: [PATCH] kernel: trace: ftrace: strncpy, using strlcpy instead of strncpy

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

On Mon, 2013-04-08 at 12:12 +0800, Chen Gang wrote:
> for NUL terminated string, need always set '\0' at the end.
>
> Signed-off-by: Chen Gang <[email protected]>
> ---
> kernel/trace/ftrace.c | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
> index dfd33f0..fa984b7 100644
> --- a/kernel/trace/ftrace.c
> +++ b/kernel/trace/ftrace.c
> @@ -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);

2013-04-10 06:26:18

by Chen Gang F T

[permalink] [raw]
Subject: Re: [PATCH] kernel: trace: ftrace: strncpy, using strlcpy instead of strncpy

On 2013年04月09日 23:00, Steven Rostedt wrote:
> 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.


--
Chen Gang

Flying Transformer