[PATCH] selftests: memfd_test.c: fix compilation warning.

From: Lei Yang
Date: Sun Nov 05 2017 - 05:57:20 EST


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@xxxxxxxxxxxxx>
---
tools/testing/selftests/memfd/memfd_test.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/memfd/memfd_test.c b/tools/testing/selftests/memfd/memfd_test.c
index f94c6d1..95df9e6 100644
--- a/tools/testing/selftests/memfd/memfd_test.c
+++ b/tools/testing/selftests/memfd/memfd_test.c
@@ -514,7 +514,7 @@ static void mfd_assert_grow_write(int fd)

buf = malloc(mfd_def_size * 8);
if (!buf) {
- printf("malloc(%d) failed: %m\n", mfd_def_size * 8);
+ printf("malloc(%zu) failed: %m\n", mfd_def_size * 8);
abort();
}

@@ -534,7 +534,7 @@ static void mfd_fail_grow_write(int fd)

buf = malloc(mfd_def_size * 8);
if (!buf) {
- printf("malloc(%d) failed: %m\n", mfd_def_size * 8);
+ printf("malloc(%zu) failed: %m\n", mfd_def_size * 8);
abort();
}

--
1.9.1