From aeac64aac538fde7c11038fc6dd2ef4bec4c39a7 Mon Sep 17 00:00:00 2001 From: Chen Gang Date: Fri, 8 Mar 2013 08:47:50 +0800 Subject: [PATCH] staging: zcache: using strlcpy instead of strncpy for NUL terminated string, need alway set '\0' in the end. Signed-off-by: Chen Gang Signed-off-by: Greg Kroah-Hartman --- drivers/staging/zcache/zcache-main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/zcache/zcache-main.c b/drivers/staging/zcache/zcache-main.c index 7c0fda4..7a6dd96 100644 --- a/drivers/staging/zcache/zcache-main.c +++ b/drivers/staging/zcache/zcache-main.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -1688,7 +1689,7 @@ __setup("nocleancacheignorenonactive", no_cleancache_ignore_nonactive); static int __init enable_zcache_compressor(char *s) { - strncpy(zcache_comp_name, s, ZCACHE_COMP_NAME_SZ); + strlcpy(zcache_comp_name, s, sizeof(zcache_comp_name)); zcache_enabled = true; return 1; } -- 2.7.4