summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChen Gang <gang.chen@asianux.com>2013-03-08 08:47:50 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-03-11 09:57:45 -0700
commitaeac64aac538fde7c11038fc6dd2ef4bec4c39a7 (patch)
tree887a3364aeea8e38110944a24603ee6ce87d1745
parentb6dd012efc8c785f8dc2441ae21ae48561788821 (diff)
staging: zcache: using strlcpy instead of strncpy
for NUL terminated string, need alway set '\0' in the end. Signed-off-by: Chen Gang <gang.chen@asianux.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/staging/zcache/zcache-main.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/staging/zcache/zcache-main.c b/drivers/staging/zcache/zcache-main.c
index 7c0fda4106a0..7a6dd966931b 100644
--- a/drivers/staging/zcache/zcache-main.c
+++ b/drivers/staging/zcache/zcache-main.c
@@ -19,6 +19,7 @@
#include <linux/slab.h>
#include <linux/spinlock.h>
#include <linux/types.h>
+#include <linux/string.h>
#include <linux/atomic.h>
#include <linux/math64.h>
#include <linux/crypto.h>
@@ -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;
}