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>
This commit is contained in:
parent
b6dd012efc
commit
aeac64aac5
1 changed files with 2 additions and 1 deletions
|
|
@ -19,6 +19,7 @@
|
||||||
#include <linux/slab.h>
|
#include <linux/slab.h>
|
||||||
#include <linux/spinlock.h>
|
#include <linux/spinlock.h>
|
||||||
#include <linux/types.h>
|
#include <linux/types.h>
|
||||||
|
#include <linux/string.h>
|
||||||
#include <linux/atomic.h>
|
#include <linux/atomic.h>
|
||||||
#include <linux/math64.h>
|
#include <linux/math64.h>
|
||||||
#include <linux/crypto.h>
|
#include <linux/crypto.h>
|
||||||
|
|
@ -1688,7 +1689,7 @@ __setup("nocleancacheignorenonactive", no_cleancache_ignore_nonactive);
|
||||||
|
|
||||||
static int __init enable_zcache_compressor(char *s)
|
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;
|
zcache_enabled = true;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue