浏览代码

selftests: memfd_test.c: fix compilation warning.

Replace '%d' by '%zu' to fix the following compilation warning.

memfd_test.c:517:3: warning: format ‘%d’ expects argument of
type ‘int’,but argument 2 has type ‘size_t’ [-Wformat=]
   printf("malloc(%d) failed: %m\n", mfd_def_size * 8);
   ^
memfd_test.c: In function ‘mfd_fail_grow_write’:
memfd_test.c:537:3: warning: format ‘%d’ expects argument
of type ‘int’,but argument 2 has type ‘size_t’ [-Wformat=]
   printf("malloc(%d) failed: %m\n", mfd_def_size * 8);

Signed-off-by: Lei Yang <Lei.Yang@windriver.com>
Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
Lei Yang 7 年之前
父节点
当前提交
7d33d2b5b8
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      tools/testing/selftests/memfd/memfd_test.c

+ 2 - 2
tools/testing/selftests/memfd/memfd_test.c

@@ -515,7 +515,7 @@ static void mfd_assert_grow_write(int fd)
 
 
 	buf = malloc(mfd_def_size * 8);
 	buf = malloc(mfd_def_size * 8);
 	if (!buf) {
 	if (!buf) {
-		printf("malloc(%d) failed: %m\n", mfd_def_size * 8);
+		printf("malloc(%zu) failed: %m\n", mfd_def_size * 8);
 		abort();
 		abort();
 	}
 	}
 
 
@@ -535,7 +535,7 @@ static void mfd_fail_grow_write(int fd)
 
 
 	buf = malloc(mfd_def_size * 8);
 	buf = malloc(mfd_def_size * 8);
 	if (!buf) {
 	if (!buf) {
-		printf("malloc(%d) failed: %m\n", mfd_def_size * 8);
+		printf("malloc(%zu) failed: %m\n", mfd_def_size * 8);
 		abort();
 		abort();
 	}
 	}