[PATCH] drivers/staging/zcache: using strlcpy instead of strncpy
Greg KH
gregkh at linuxfoundation.org
Tue Mar 5 08:45:14 UTC 2013
On Sun, Feb 17, 2013 at 10:30:01AM +0800, Chen Gang wrote:
>
> for NUL terminated string, need alway set '\0' in the end.
>
> Signed-off-by: Chen Gang <gang.chen at asianux.com>
> ---
> drivers/staging/zcache/zcache-main.c | 3 ++-
> 1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/staging/zcache/zcache-main.c b/drivers/staging/zcache/zcache-main.c
> index 4456ab4..e6daed7 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>
> @@ -1899,7 +1900,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));
This patch fails to apply to my tree :(
More information about the devel
mailing list