* [PATCH] arch: blackfin: kernel: using strlcpy instead of strncpy
@ 2013-05-26 7:04 Chen Gang
2013-05-27 1:50 ` Chen Gang
2013-05-27 1:51 ` [PATCH v2] arch: blackfin: kernel: using strlcpy() instead of strncpy() Chen Gang
0 siblings, 2 replies; 3+ messages in thread
From: Chen Gang @ 2013-05-26 7:04 UTC (permalink / raw)
To: Mike Frysinger, Paul Mundt, realmz paranoid, Geert Uytterhoeven,
monstr, uclinux-dist-devel@blackfin.uclinux.org,
linux-kernel@vger.kernel.org, Linux-Arch
For NULL terminated string, need always be sure of ended by zero.
'command_line' is a static variable which will be initialized
automatically, and cmdline_init() is __init function, so need not
initialize it again, can just use strlcpy instead of strncpy.
Signed-off-by: Chen Gang <gang.chen@asianux.com>
---
arch/blackfin/kernel/setup.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/arch/blackfin/kernel/setup.c b/arch/blackfin/kernel/setup.c
index 107b306..c731ec7 100644
--- a/arch/blackfin/kernel/setup.c
+++ b/arch/blackfin/kernel/setup.c
@@ -1458,5 +1458,5 @@ void __init cmdline_init(const char *r0)
{
early_shadow_stamp();
if (r0)
- strncpy(command_line, r0, COMMAND_LINE_SIZE);
+ strlcpy(command_line, r0, COMMAND_LINE_SIZE);
}
--
1.7.7.6
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] arch: blackfin: kernel: using strlcpy instead of strncpy
2013-05-26 7:04 [PATCH] arch: blackfin: kernel: using strlcpy instead of strncpy Chen Gang
@ 2013-05-27 1:50 ` Chen Gang
2013-05-27 1:51 ` [PATCH v2] arch: blackfin: kernel: using strlcpy() instead of strncpy() Chen Gang
1 sibling, 0 replies; 3+ messages in thread
From: Chen Gang @ 2013-05-27 1:50 UTC (permalink / raw)
To: Mike Frysinger, Paul Mundt, realmz paranoid, Geert Uytterhoeven,
monstr, uclinux-dist-devel@blackfin.uclinux.org,
linux-kernel@vger.kernel.org, Linux-Arch
On 05/26/2013 03:04 PM, Chen Gang wrote:
>
> For NULL terminated string, need always be sure of ended by zero.
>
> 'command_line' is a static variable which will be initialized
> automatically, and cmdline_init() is __init function, so need not
> initialize it again, can just use strlcpy instead of strncpy.
>
The 2nd paragraph comment is redundent, need delete. I will send patch v2.
>
> Signed-off-by: Chen Gang <gang.chen@asianux.com>
> ---
> arch/blackfin/kernel/setup.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/arch/blackfin/kernel/setup.c b/arch/blackfin/kernel/setup.c
> index 107b306..c731ec7 100644
> --- a/arch/blackfin/kernel/setup.c
> +++ b/arch/blackfin/kernel/setup.c
> @@ -1458,5 +1458,5 @@ void __init cmdline_init(const char *r0)
> {
> early_shadow_stamp();
> if (r0)
> - strncpy(command_line, r0, COMMAND_LINE_SIZE);
> + strlcpy(command_line, r0, COMMAND_LINE_SIZE);
> }
>
--
Chen Gang
Asianux Corporation
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH v2] arch: blackfin: kernel: using strlcpy() instead of strncpy()
2013-05-26 7:04 [PATCH] arch: blackfin: kernel: using strlcpy instead of strncpy Chen Gang
2013-05-27 1:50 ` Chen Gang
@ 2013-05-27 1:51 ` Chen Gang
1 sibling, 0 replies; 3+ messages in thread
From: Chen Gang @ 2013-05-27 1:51 UTC (permalink / raw)
To: Mike Frysinger, Paul Mundt, realmz paranoid, Geert Uytterhoeven,
monstr, uclinux-dist-devel@blackfin.uclinux.org,
linux-kernel@vger.kernel.org, Linux-Arch
For NULL terminated string, need always be sure of ended by zero.
Just use strlcpy() instead of strncpy().
Signed-off-by: Chen Gang <gang.chen@asianux.com>
---
arch/blackfin/kernel/setup.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/arch/blackfin/kernel/setup.c b/arch/blackfin/kernel/setup.c
index 107b306..c731ec7 100644
--- a/arch/blackfin/kernel/setup.c
+++ b/arch/blackfin/kernel/setup.c
@@ -1458,5 +1458,5 @@ void __init cmdline_init(const char *r0)
{
early_shadow_stamp();
if (r0)
- strncpy(command_line, r0, COMMAND_LINE_SIZE);
+ strlcpy(command_line, r0, COMMAND_LINE_SIZE);
}
--
1.7.7.6
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-05-27 1:52 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-26 7:04 [PATCH] arch: blackfin: kernel: using strlcpy instead of strncpy Chen Gang
2013-05-27 1:50 ` Chen Gang
2013-05-27 1:51 ` [PATCH v2] arch: blackfin: kernel: using strlcpy() instead of strncpy() 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.