]> rtime.felk.cvut.cz Git - linux-imx.git/commitdiff
staging: zcache: using strlcpy instead of strncpy
authorChen Gang <gang.chen@asianux.com>
Fri, 8 Mar 2013 00:47:50 +0000 (08:47 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 11 Mar 2013 16:57:45 +0000 (09:57 -0700)
  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>
drivers/staging/zcache/zcache-main.c

index 7c0fda4106a084bceb274731de102959768210eb..7a6dd966931bb78fba747d132b130d2718df3f49 100644 (file)
@@ -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;
 }