From: Ryan Roberts <ryan.roberts@arm.com>
To: John Hubbard <jhubbard@nvidia.com>, Shuah Khan <shuah@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
David Hildenbrand <david@redhat.com>,
SeongJae Park <sj@kernel.org>,
Valentin Obst <kernel@valentinobst.de>,
linux-kselftest@vger.kernel.org,
LKML <linux-kernel@vger.kernel.org>,
llvm@lists.linux.dev
Subject: Re: [PATCH] selftests/mqueue: fix 5 warnings about signed/unsigned mismatches
Date: Wed, 8 May 2024 10:14:05 +0100 [thread overview]
Message-ID: <c7a1fa3a-3e0a-4da4-8bdc-8d5b98d662c0@arm.com> (raw)
In-Reply-To: <c8dd4b34-f49a-4929-9b14-d2cc17e0edd8@nvidia.com>
On 07/05/2024 18:04, John Hubbard wrote:
> 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.
Ahh I see. It would certainly be an improvement, but if you don't think it's
worth the effort, then don't feel you need to do it on my account.
>
>
> thanks,
prev parent reply other threads:[~2024-05-08 9:14 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-05 22:13 [PATCH] selftests/mqueue: fix 5 warnings about signed/unsigned mismatches John Hubbard
2024-05-07 7:54 ` Ryan Roberts
2024-05-07 17:04 ` John Hubbard
2024-05-08 9:14 ` Ryan Roberts [this message]
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=c7a1fa3a-3e0a-4da4-8bdc-8d5b98d662c0@arm.com \
--to=ryan.roberts@arm.com \
--cc=akpm@linux-foundation.org \
--cc=david@redhat.com \
--cc=jhubbard@nvidia.com \
--cc=kernel@valentinobst.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=shuah@kernel.org \
--cc=sj@kernel.org \
/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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).