Re: [PATCH] drivers/staging/zcache: using strlcpy instead of strncpy

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



于 2013年03月05日 16:45, Greg KH 写道:
> This patch fails to apply to my tree :(

  the relative file has been changed much during these days.
  I need send the patch again based on next-20130307 tree.

  I append the patch below, if need send it with patch v2, please tell me, thanks.



From: Chen Gang <gang.chen@xxxxxxxxxxx>
Date: Thu, 7 Mar 2013 12:53:31 +0800
Subject: [PATCH] drivers/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@xxxxxxxxxxx>
---
 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 7c0fda4..7a6dd96 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;
 }
-- 
1.7.7.6

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux