selftests: memfd_test.c: fix compilation warning.
authorLei Yang <Lei.Yang@windriver.com>
Sun, 5 Nov 2017 10:56:40 +0000 (18:56 +0800)
committerShuah Khan <shuahkh@osg.samsung.com>
Wed, 15 Nov 2017 15:07:53 +0000 (08:07 -0700)
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>
tools/testing/selftests/memfd/memfd_test.c

index 845e5f67b6f0245fabedc8367ecefb3ba3ad0de9..132a54f74e883963bf45a42cfc17533a306e8bd6 100644 (file)
@@ -515,7 +515,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();
        }
 
@@ -535,7 +535,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();
        }