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]
Message-ID: <c8dd4b34-f49a-4929-9b14-d2cc17e0edd8@nvidia.com>
Date: Tue, 7 May 2024 10:04:12 -0700
From: John Hubbard <jhubbard@...dia.com>
To: Ryan Roberts <ryan.roberts@....com>, Shuah Khan <shuah@...nel.org>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
 David Hildenbrand <david@...hat.com>, SeongJae Park <sj@...nel.org>,
 Valentin Obst <kernel@...entinobst.de>, linux-kselftest@...r.kernel.org,
 LKML <linux-kernel@...r.kernel.org>, llvm@...ts.linux.dev
Subject: Re: [PATCH] selftests/mqueue: fix 5 warnings about signed/unsigned
 mismatches

On 5/7/24 12:54 AM, Ryan Roberts wrote:
> On 05/05/2024 23:13, John Hubbard wrote:
..
>> diff --git a/tools/testing/selftests/mqueue/mq_perf_tests.c b/tools/testing/selftests/mqueue/mq_perf_tests.c
>> index 5c16159d0bcd..fb898850867c 100644
>> --- a/tools/testing/selftests/mqueue/mq_perf_tests.c
>> +++ b/tools/testing/selftests/mqueue/mq_perf_tests.c
>> @@ -323,7 +323,8 @@ void *fake_cont_thread(void *arg)
>>   void *cont_thread(void *arg)
>>   {
>>   	char buff[MSG_SIZE];
>> -	int i, priority;
>> +	int i;
>> +	unsigned int priority;
>>   
>>   	for (i = 0; i < num_cpus_to_pin; i++)
>>   		if (cpu_threads[i] == pthread_self())
>> @@ -425,7 +426,8 @@ struct test test2[] = {
>>   void *perf_test_thread(void *arg)
>>   {
>>   	char buff[MSG_SIZE];
>> -	int prio_out, prio_in;
>> +	int prio_out;
> 
> It feels a bit odd for prio_out and prio_in to have different types. I don't
> have any prior familiararity with these tests but looks like they are ultimately
> the parameters of mq_send() and mq_receive() which both define them as unsigned
> ints. Perhaps both should be converted?


This makes sense, and I recall wondering about it. Looking at it again,
I see why didn't go that far: there is a mini-unit test manager inside,
passing around priorities that are signed, throughout:

         struct test {
         	char *desc; void (*func)(int *);
         };

         ...

         void inc_prio(int *prio) {
         	if (++*prio == mq_prio_max)
         		*prio = 0;
         }

However, I can probably fix up everything to match up. Given that you've
called it out, I'll go ahead with that approach. Iit will be quite a few
changes but they will all be trivial too.		


thanks,
-- 
John Hubbard
NVIDIA

> 
>> +	unsigned int prio_in;
>>   	int i;
>>   	clockid_t clock;
>>   	pthread_t *t;
>>
>> base-commit: f462ae0edd3703edd6f22fe41d336369c38b884b
>> prerequisite-patch-id: b901ece2a5b78503e2fb5480f20e304d36a0ea27
> 



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ