Skip to content

Commit

Permalink
selftests: memfd_test.c: fix compilation warning.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Lei Yang authored and Shuah Khan committed Nov 15, 2017
1 parent 42534b1 commit 7d33d2b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tools/testing/selftests/memfd/memfd_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand All @@ -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();
}

Expand Down

0 comments on commit 7d33d2b

Please sign in to comment.