Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Lei Yang and committed by
Shuah Khan
7d33d2b5 42534b1f

+2 -2
+2 -2
tools/testing/selftests/memfd/memfd_test.c
··· 515 515 516 516 buf = malloc(mfd_def_size * 8); 517 517 if (!buf) { 518 - printf("malloc(%d) failed: %m\n", mfd_def_size * 8); 518 + printf("malloc(%zu) failed: %m\n", mfd_def_size * 8); 519 519 abort(); 520 520 } 521 521 ··· 535 535 536 536 buf = malloc(mfd_def_size * 8); 537 537 if (!buf) { 538 - printf("malloc(%d) failed: %m\n", mfd_def_size * 8); 538 + printf("malloc(%zu) failed: %m\n", mfd_def_size * 8); 539 539 abort(); 540 540 } 541 541