From: Anshuman Khandual <anshuman.khandual@arm.com>
To: Mark Brown <broonie@kernel.org>
Cc: linux-arm-kernel@lists.infradead.org,
Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will@kernel.org>, Shuah Khan <shuah@kernel.org>,
linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] selftests/arm64: Prevent build warnings from -Wmaybe-uninitialized
Date: Fri, 27 Jun 2025 16:15:09 +0530 [thread overview]
Message-ID: <af5cbd48-6312-481d-8e91-7739612493c1@arm.com> (raw)
In-Reply-To: <dd3dee5a-b030-4658-8cef-c777928368d4@sirena.org.uk>
On 25/06/25 3:54 PM, Mark Brown wrote:
> On Wed, Jun 25, 2025 at 03:01:38AM +0100, Anshuman Khandual wrote:
>
>> @@ -96,7 +96,7 @@ static int write_sleep_read(void)
>> static int write_fork_read(void)
>> {
>> pid_t newpid, waiting, oldpid;
>> - int status;
>> + int status = 0;
>>
>> set_tpidr2(getpid());
>>
>
> This will shut the warnings up, but it's a bit of a heavy hammer that
> means that the warning can never trigger warnings for that variable
> being unused. Is it possible to fix this by updating the control flow
> such that the compiler can tell that the initialisation follows the use?
The problem might not exist in reality. In the test function test_fork()
in the file tools/testing/selftests/arm64/gcs/basic-gcs.c there does not
seem to be a path where WIFEXITED(status) might get called when 'status'
has not been initialized as there is a preceding waitpid() which would
ensure 'status' gets set. Similar scenarios are present in fork_test_c()
and write_fork_read() as well.
But the compiler still throws these build warnings. Seems to be false
positives and this fix just works around that.
next prev parent reply other threads:[~2025-06-27 10:45 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-25 2:01 Anshuman Khandual
2025-06-25 10:24 ` Mark Brown
2025-06-27 10:45 ` Anshuman Khandual [this message]
2025-06-27 10:55 ` Mark Brown
2025-07-07 13:10 ` Thomas Weißschuh
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=af5cbd48-6312-481d-8e91-7739612493c1@arm.com \
--to=anshuman.khandual@arm.com \
--cc=broonie@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=shuah@kernel.org \
--cc=will@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
all inboxes | Powered by JetHome®