From: lei yang <lei.yang@windriver.com>
To: Shuah Khan <shuahkh@osg.samsung.com>
Cc: <linux-kselftest@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
Shuah Khan <shuah@kernel.org>
Subject: Re: [PATCH] selftests: memfd_test.c: fix compilation warning.
Date: Tue, 7 Nov 2017 09:11:59 +0800 [thread overview]
Message-ID: <52f83b6e-0472-bf5b-6a00-571c56b6732d@windriver.com> (raw)
In-Reply-To: <6a76f65a-a484-ba72-6cc5-85010666359c@osg.samsung.com>
On 2017年11月07日 07:46, Shuah Khan wrote:
> On 11/05/2017 03:56 AM, Lei Yang wrote:
>> 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();
>> }
>>
>>
> Relates to gcc version perhaps. What's your gcc version?
$ cat /proc/version
Linux version 3.16.0-30-generic (buildd@kissel) (gcc version 4.8.2
(Ubuntu 4.8.2-19ubuntu1) ) #40~14.04.1-Ubuntu SMP Thu Jan 15 17:43:14
UTC 2015
Lei
> thanks,
> -- Shuah
next prev parent reply other threads:[~2017-11-07 1:12 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-05 10:56 Lei Yang
2017-11-06 23:46 ` Shuah Khan
2017-11-07 1:11 ` lei yang [this message]
2017-11-08 3:22 ` lei yang
2017-11-09 20:14 ` Shuah Khan
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=52f83b6e-0472-bf5b-6a00-571c56b6732d@windriver.com \
--to=lei.yang@windriver.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=shuah@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®