lkml.org 
[lkml]   [2013]   [May]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] arch: blackfin: kernel: using strlcpy instead of strncpy

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

\
 
 \ /
  Last update: 2013-05-26 09:41    [W:0.069 / U:0.328 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site