All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] arch: mips: kernel: using strlcpy() instead of strncpy()
@ 2013-05-26  8:06 Chen Gang
  2013-05-27 10:38 ` John Crispin
  0 siblings, 1 reply; 2+ messages in thread
From: Chen Gang @ 2013-05-26  8:06 UTC (permalink / raw)
  To: ralf, blogic, david.daney
  Cc: linux-mips, Linux-Arch, linux-kernel@vger.kernel.org


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

Or the next pr_info() will cause issue.


Signed-off-by: Chen Gang <gang.chen@asianux.com>
---
 arch/mips/kernel/prom.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/mips/kernel/prom.c b/arch/mips/kernel/prom.c
index 5712bb5..7e95404 100644
--- a/arch/mips/kernel/prom.c
+++ b/arch/mips/kernel/prom.c
@@ -30,7 +30,7 @@ __init void mips_set_machine_name(const char *name)
 	if (name == NULL)
 		return;
 
-	strncpy(mips_machine_name, name, sizeof(mips_machine_name));
+	strlcpy(mips_machine_name, name, sizeof(mips_machine_name));
 	pr_info("MIPS: machine is %s\n", mips_get_machine_name());
 }
 
-- 
1.7.7.6

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

* Re: [PATCH] arch: mips: kernel: using strlcpy() instead of strncpy()
  2013-05-26  8:06 [PATCH] arch: mips: kernel: using strlcpy() instead of strncpy() Chen Gang
@ 2013-05-27 10:38 ` John Crispin
  0 siblings, 0 replies; 2+ messages in thread
From: John Crispin @ 2013-05-27 10:38 UTC (permalink / raw)
  To: linux-mips

On 26/05/13 10:06, Chen Gang wrote:
> For NUL terminated string, need always be sure of ended by zero.
>
> Or the next pr_info() will cause issue.
>
>
> Signed-off-by: Chen Gang<gang.chen@asianux.com>
> ---
>   arch/mips/kernel/prom.c |    2 +-
>   1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/arch/mips/kernel/prom.c b/arch/mips/kernel/prom.c
> index 5712bb5..7e95404 100644
> --- a/arch/mips/kernel/prom.c
> +++ b/arch/mips/kernel/prom.c
> @@ -30,7 +30,7 @@ __init void mips_set_machine_name(const char *name)
>   	if (name == NULL)
>   		return;
>
> -	strncpy(mips_machine_name, name, sizeof(mips_machine_name));
> +	strlcpy(mips_machine_name, name, sizeof(mips_machine_name));
>   	pr_info("MIPS: machine is %s\n", mips_get_machine_name());
>   }
>
Acked-by: John Crispin <blogic@openwrt.org>

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

end of thread, other threads:[~2013-05-27 10:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-26  8:06 [PATCH] arch: mips: kernel: using strlcpy() instead of strncpy() Chen Gang
2013-05-27 10:38 ` John Crispin

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.