From: Chen Gang Date: Fri, 8 Mar 2013 00:47:50 +0000 (+0800) Subject: staging: zcache: using strlcpy instead of strncpy X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=aeac64aac538fde7c11038fc6dd2ef4bec4c39a7;p=~shefty%2Frdma-dev.git 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 --- diff --git a/drivers/staging/zcache/zcache-main.c b/drivers/staging/zcache/zcache-main.c index 7c0fda4106a..7a6dd966931 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; }