From: Andrew Morton <akpm@linux-foundation.org>
To: Alexey Suchkov <aleks.koyf@gmail.com>
Cc: dywoq.contact@gmail.com, linux-kernel@vger.kernel.org,
linux-mm@kvack.org, Matthew Wilcox <willy@infradead.org>,
Joshua Hahn <joshua.hahnjy@gmail.com>
Subject: Re: [PATCH] [PATCH v2] mm: initialize 'seq' in gup_fast to remove -Wmaybe-uninitialized warning
Date: Mon, 2 Mar 2026 12:43:05 -0800 [thread overview]
Message-ID: <20260302124305.6bb7f34228bfe07094de51ca@linux-foundation.org> (raw)
In-Reply-To: <20260302193405.37961-1-dywoq.contact@gmail.com>
On Mon, 2 Mar 2026 22:34:05 +0300 Alexey Suchkov <aleks.koyf@gmail.com> wrote:
> The local variable 'seq' in gup_fast (mm/gup.c) was declared
> without initialization, which can trigger:
>
> mm/gup.c:3165:20: warning: ‘seq’ may be used uninitialized [-Wmaybe-uninitialized]
>
> Initialize 'seq' to 0. This does not change behavior, since
> read_seqcount_retry() always writes to it before use.
>
> ...
>
> --- a/mm/gup.c
> +++ b/mm/gup.c
> @@ -3131,7 +3131,7 @@ static unsigned long gup_fast(unsigned long start, unsigned long end,
> {
> unsigned long flags;
> int nr_pinned = 0;
> - unsigned seq;
> + unsigned int seq = 0;
>
> if (!IS_ENABLED(CONFIG_HAVE_GUP_FAST) ||
> !gup_fast_permitted(start, end))
stupid gcc. I liked uninitalized_var(), particularly for its
self-documenting nature. Never agreed with Linus's hate on it.
Thanks, I tweaked the changelog a bit:
: The local variable 'seq' in gup_fast (mm/gup.c) was declared
: without initialization, which with gcc-15.2.1 can trigger:
:
: mm/gup.c:3165:20: warning: `seq' may be used uninitialized [-Wmaybe-uninitialized]
:
: Work around this by initializing 'seq' to 0. This does not change
: behavior, since read_seqcount_retry() always writes to it before use.
prev parent reply other threads:[~2026-03-02 20:43 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-02 19:12 [PATCH] " Alexey Suchkov
2026-03-02 19:22 ` Matthew Wilcox
2026-03-02 19:34 ` [PATCH] [PATCH v2] " Alexey Suchkov
2026-03-02 19:44 ` Matthew Wilcox
2026-03-02 19:57 ` Alexey Suchkov
2026-03-02 19:48 ` Joshua Hahn
2026-03-02 19:53 ` Matthew Wilcox
2026-03-02 20:09 ` Alexey Suchkov
2026-03-02 20:43 ` Andrew Morton [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=20260302124305.6bb7f34228bfe07094de51ca@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=aleks.koyf@gmail.com \
--cc=dywoq.contact@gmail.com \
--cc=joshua.hahnjy@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=willy@infradead.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