Skip to content

Commit 7d33d2b

Browse files
Lei YangShuah Khan
authored andcommitted
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>
1 parent 42534b1 commit 7d33d2b

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎tools/testing/selftests/memfd/memfd_test.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,7 @@ static void mfd_assert_grow_write(int fd)
515515

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

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

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

0 commit comments

Comments
 (0)