Received: by 2002:ab2:6991:0:b0:1f7:f6c3:9cb1 with SMTP id v17csp1127265lqo; Thu, 9 May 2024 05:44:40 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVwFXo+qLLegneBmv9etSMgjmcMP96h8wdvPZIgcxLmYyO2bypp0PBz29I8bgXslvB1+uTjNMtqcSemHPpfESVGVNQ/tC31WJF8MiCGbg== X-Google-Smtp-Source: AGHT+IF4qMC5gRUf/zCJMdI6JgLGUZJDmgLMWa96WiI6ve4umqKghZQYv8CqL9asJrWiPoPCEUw+ X-Received: by 2002:a05:6a20:7292:b0:1af:cbe1:8a4e with SMTP id adf61e73a8af0-1afd14813f9mr3860044637.23.1715258680292; Thu, 09 May 2024 05:44:40 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715258680; cv=pass; d=google.com; s=arc-20160816; b=tt23fdA//unltvVAoCBOIiDg7UjcuX2y5Zns7NxwQf5Ga+DKdbTQGDVyuSed0Ifylh vjyxvfM7CqP6EemR9vnVHd+ZZ7lwmcgCwQnobBIMVb7LZJRi5tPs+6BDe9DkBFjU0VW5 Tj2T4w2a2+XONvo8WOpdxfdbskXfVlQgpv5cjsKFZQ9Dmhd5CDfWxZXgZldX67/aCvG8 3gyILmyCG7iJyOrfIuSMmSUrbecy1xdQgdudmJcqLn/MPhykOqkaUz+G07NyvRjpUte/ QyDH3k5Mrv8uWUHlEysToDYKZNxFvBRGmxwrhxGqgchYbPZEZbPOnGOn3EskhD8n4vG5 jLeA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=3f1+W5VNOkFZJJ1kwqboLfecAaMtQtwJlMeRascGLUM=; fh=rkqz0Q1xIDDilFS/MAb4ByJ3tXxcFXtmT610YTbLkEk=; b=WRNIS7N/+JLaF8KTei3IUYWsT1GO6Yhz+aW6HB1sNnWJ3BksLHEoD7nqyP7nTb/xds HUG1CQncz1DE3o27aB1mJ8Xoq6aiRGooZ14lBZ4zkltoCFnnifs2wkIXpCeN/DqxnvG1 kCOUVYPAHhdVzt+lULqoEM9j3ral/YIS92Ad3s4TGy/BNCzeLMF1P7EmJHBF7NaE8rJ1 AV8kPE0jUBlczHYCsECSeVqVyC839LHhuR178/8EgdKC19cUhdSpRQLLOWNFhCKTJTbK 3n+DBmSxfZWdyt6H4I2SvGUBupjm1B3o6086gTeXG5tEUg8qpg99fuJ1dH5rwZAYK/vv jL+g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-174509-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-174509-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id d2e1a72fcca58-6f4d2b43be1si1403913b3a.367.2024.05.09.05.44.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 May 2024 05:44:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-174509-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-174509-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-174509-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id EB9F3B21214 for ; Thu, 9 May 2024 12:43:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B69E61474CE; Thu, 9 May 2024 12:43:05 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 84B7A13B5B6; Thu, 9 May 2024 12:43:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715258585; cv=none; b=DYhRDjljLJWRJTU79QbXxLnFUMJogW6cOco+OEFMxhagH9oeijqc/YXoau27MFvD5lUWaU5mDVWyTbrWLU6u7K+zPRo3vVffqo2v5oDwwP8iAFv72LePn/llxbKTTZ8gZL/kZKqspbwPfAxTeOYuPGDV9SM8hr13JIk50TLxK7w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715258585; c=relaxed/simple; bh=8BmZZE6TqpdGCbZ9A4QnBHieZRxO5UaDwlFmlYZ9Nos=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=F6nVsZYtW4C5N3sWxiI2OaKDqirR/GyMUCPPtWUC5rOE+knYteuNlOXew3r590Q9tor/u0BzekS4VENT7Q/EXfH14+TOyxNpBgK96pjUavDQqRDlit3CpUv1O5N2QIEM/Pwh4NZdwooDdD+xg44czPUIRC887CMhit5akWhrSPA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 0F6D1339; Thu, 9 May 2024 05:43:28 -0700 (PDT) Received: from [10.1.38.172] (XHFQ2J9959.cambridge.arm.com [10.1.38.172]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 59D6E3F6A8; Thu, 9 May 2024 05:43:01 -0700 (PDT) Message-ID: <444612f4-8f3c-445f-bbdb-9b391dd5d5db@arm.com> Date: Thu, 9 May 2024 13:42:59 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2] selftests/mqueue: fix 5 warnings about signed/unsigned mismatches Content-Language: en-GB To: John Hubbard , Shuah Khan Cc: Andrew Morton , David Hildenbrand , SeongJae Park , Valentin Obst , linux-kselftest@vger.kernel.org, LKML , llvm@lists.linux.dev References: <20240508200028.272513-1-jhubbard@nvidia.com> From: Ryan Roberts In-Reply-To: <20240508200028.272513-1-jhubbard@nvidia.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 08/05/2024 21:00, John Hubbard wrote: > When building with clang, via: > > make LLVM=1 -C tools/testing/selftest > > ...clang warns about several cases of using a signed integer for the > priority argument to mq_receive(3), which expects an unsigned int. > > Fix this by declaring the type as unsigned int in all cases. > > Also, both input and output priority are unsigned, per the man pages, so > let's change the type of both priorities throughout, even though clang > did not warn about the prio_out variable. > > Also, add an argument name to test->func(), in order to address another > warning from clang. > > Cc: Ryan Roberts > Signed-off-by: John Hubbard Reviewed-by: Ryan Roberts > --- > tools/testing/selftests/mqueue/mq_perf_tests.c | 15 ++++++++------- > 1 file changed, 8 insertions(+), 7 deletions(-) > > diff --git a/tools/testing/selftests/mqueue/mq_perf_tests.c b/tools/testing/selftests/mqueue/mq_perf_tests.c > index 5c16159d0bcd..9380c656581f 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()) > @@ -373,27 +374,27 @@ void *cont_thread(void *arg) > > struct test { > char *desc; > - void (*func)(int *); > + void (*func)(unsigned int *prio); > }; > > -void const_prio(int *prio) > +void const_prio(unsigned int *prio) > { > return; > } > > -void inc_prio(int *prio) > +void inc_prio(unsigned int *prio) > { > if (++*prio == mq_prio_max) > *prio = 0; > } > > -void dec_prio(int *prio) > +void dec_prio(unsigned int *prio) > { > if (--*prio < 0) > *prio = mq_prio_max - 1; > } > > -void random_prio(int *prio) > +void random_prio(unsigned int *prio) > { > *prio = random() % mq_prio_max; > } > @@ -425,7 +426,7 @@ struct test test2[] = { > void *perf_test_thread(void *arg) > { > char buff[MSG_SIZE]; > - int prio_out, prio_in; > + unsigned int prio_out, prio_in; > int i; > clockid_t clock; > pthread_t *t; > > base-commit: 45db3ab70092637967967bfd8e6144017638563c > prerequisite-patch-id: b901ece2a5b78503e2fb5480f20e304d36a0ea27