lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 7 Nov 2017 09:11:59 +0800
From:   lei yang <lei.yang@...driver.com>
To:     Shuah Khan <shuahkh@....samsung.com>
CC:     <linux-kselftest@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
        Shuah Khan <shuah@...nel.org>
Subject: Re: [PATCH] selftests: memfd_test.c: fix compilation warning.



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@...driver.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@...sel) (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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ