All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lei Yang <Lei.Yang@windriver.com>
To: <lei.yang@windriver.com>, <shuahkh@osg.samsung.com>,
	<linux-kselftest@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: [PATCH] selftests: memfd_test.c: fix compilation warning.
Date: Sun, 5 Nov 2017 18:56:40 +0800	[thread overview]
Message-ID: <1509879400-26061-1-git-send-email-Lei.Yang@windriver.com> (raw)

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>
---
 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

             reply	other threads:[~2017-11-05 10:57 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-05 10:56 Lei Yang [this message]
2017-11-06 23:46 ` [PATCH] selftests: memfd_test.c: fix compilation warning Shuah Khan
2017-11-07  1:11   ` lei yang
2017-11-08  3:22   ` lei yang
2017-11-08  3:22     ` [Linux-kselftest-mirror] " lei yang
2017-11-08  3:22     ` lei.yang
2017-11-09 20:14 ` Shuah Khan
2017-11-09 20:14   ` [Linux-kselftest-mirror] " Shuah Khan
2017-11-09 20:14   ` shuahkh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1509879400-26061-1-git-send-email-Lei.Yang@windriver.com \
    --to=lei.yang@windriver.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=shuahkh@osg.samsung.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.