[LTP] [PATCH v2] change type of variable to fix compile warning

Sun Lianwen sunlw.fnst@cn.fujitsu.com
Sat Jun 9 05:01:06 CEST 2018


Change the type of variable from int to unsigned intto fix complie 
warning: "comparison between signed and unsigned integer expressions [-Wsign-compare]"

Signed-off-by: Sun Lianwen <sunlw.fnst@cn.fujitsu.com>
---
 testcases/kernel/syscalls/move_pages/move_pages_support.c | 2 +-
 testcases/kernel/syscalls/symlink/symlink01.c             | 2 +-
 utils/benchmark/ebizzy-0.3/ebizzy.c                       | 8 ++++----
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/testcases/kernel/syscalls/move_pages/move_pages_support.c b/testcases/kernel/syscalls/move_pages/move_pages_support.c
index 610f570d0..77dfd07f2 100644
--- a/testcases/kernel/syscalls/move_pages/move_pages_support.c
+++ b/testcases/kernel/syscalls/move_pages/move_pages_support.c
@@ -62,7 +62,7 @@ void free_pages(void **pages, unsigned int num)
  */
 int alloc_pages_on_nodes(void **pages, unsigned int num, int *nodes)
 {
-	int i;
+	unsigned int i;
 #ifdef HAVE_NUMA_V2
 	size_t onepage = get_page_size();
 #endif
diff --git a/testcases/kernel/syscalls/symlink/symlink01.c b/testcases/kernel/syscalls/symlink/symlink01.c
index 03a51a5cb..50805f7bb 100644
--- a/testcases/kernel/syscalls/symlink/symlink01.c
+++ b/testcases/kernel/syscalls/symlink/symlink01.c
@@ -584,7 +584,7 @@ int main(int argc, char *argv[])
  ***********************************************************************/
 struct tcses *get_tcs_info(char *ptr)
 {
-	int ctr;
+	unsigned int ctr;
 	struct tcses *tcs_ptr;
 
 #if ALL
diff --git a/utils/benchmark/ebizzy-0.3/ebizzy.c b/utils/benchmark/ebizzy-0.3/ebizzy.c
index 5bb8eff56..8a433e8e1 100644
--- a/utils/benchmark/ebizzy-0.3/ebizzy.c
+++ b/utils/benchmark/ebizzy-0.3/ebizzy.c
@@ -228,7 +228,7 @@ static void read_options(int argc, char *argv[])
 
 static void touch_mem(char *dest, size_t size)
 {
-	int i;
+	unsigned int i;
 	if (touch_pages) {
 		for (i = 0; i < size; i += page_size)
 			*(dest + i) = 0xff;
@@ -279,7 +279,7 @@ static void my_memcpy(void *dest, void *src, size_t len)
 {
 	char *d = (char *)dest;
 	char *s = (char *)src;
-	int i;
+	unsigned int i;
 
 	for (i = 0; i < len; i++)
 		d[i] = s[i];
@@ -288,7 +288,7 @@ static void my_memcpy(void *dest, void *src, size_t len)
 
 static void allocate(void)
 {
-	int i;
+	unsigned int i;
 
 	mem = alloc_mem(chunks * sizeof(record_t *));
 
@@ -313,7 +313,7 @@ static void allocate(void)
 
 static void write_pattern(void)
 {
-	int i, j;
+	unsigned int i, j;
 
 	for (i = 0; i < chunks; i++) {
 		for (j = 0; j < chunk_size / record_size; j++)
-- 
2.17.0





More information about the ltp mailing list