All of lore.kernel.org
 help / color / mirror / Atom feed
* + mm-initialize-seq-in-gup_fast-to-remove-wmaybe-uninitialized-warning.patch added to mm-new branch
@ 2026-03-02 20:43 Andrew Morton
  2026-03-02 21:08 ` David Hildenbrand (Arm)
  2026-03-03  0:06 ` Matthew Wilcox
  0 siblings, 2 replies; 5+ messages in thread
From: Andrew Morton @ 2026-03-02 20:43 UTC (permalink / raw)
  To: mm-commits, willy, peterx, joshua.hahnjy, jhubbard, jgg,
	dywoq.contact, david, aleks.koyf, akpm


The patch titled
     Subject: mm: initialize 'seq' in gup_fast to remove -Wmaybe-uninitialized warning
has been added to the -mm mm-new branch.  Its filename is
     mm-initialize-seq-in-gup_fast-to-remove-wmaybe-uninitialized-warning.patch

This patch will shortly appear at
     https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-initialize-seq-in-gup_fast-to-remove-wmaybe-uninitialized-warning.patch

This patch will later appear in the mm-new branch at
    git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

Note, mm-new is a provisional staging ground for work-in-progress
patches, and acceptance into mm-new is a notification for others take
notice and to finish up reviews.  Please do not hesitate to respond to
review feedback and post updated versions to replace or incrementally
fixup patches in mm-new.

The mm-new branch of mm.git is not included in linux-next

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next via various
branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days

------------------------------------------------------
From: Alexey Suchkov <aleks.koyf@gmail.com>
Subject: mm: initialize 'seq' in gup_fast to remove -Wmaybe-uninitialized warning
Date: Mon, 2 Mar 2026 22:34:05 +0300

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.

Link: https://lkml.kernel.org/r/20260302193405.37961-1-dywoq.contact@gmail.com
Signed-off-by: Alexey Suchkov <dywoq.contact@gmail.com>
Cc: David Hildenbrand <david@kernel.org>
Cc: Jason Gunthorpe <jgg@ziepe.ca>
Cc: John Hubbard <jhubbard@nvidia.com>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Peter Xu <peterx@redhat.com>
Cc: Joshua Hahn <joshua.hahnjy@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 mm/gup.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/mm/gup.c~mm-initialize-seq-in-gup_fast-to-remove-wmaybe-uninitialized-warning
+++ a/mm/gup.c
@@ -3131,7 +3131,7 @@ static unsigned long gup_fast(unsigned l
 {
 	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))
_

Patches currently in -mm which might be from aleks.koyf@gmail.com are

mm-initialize-seq-in-gup_fast-to-remove-wmaybe-uninitialized-warning.patch


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: + mm-initialize-seq-in-gup_fast-to-remove-wmaybe-uninitialized-warning.patch added to mm-new branch
  2026-03-02 20:43 + mm-initialize-seq-in-gup_fast-to-remove-wmaybe-uninitialized-warning.patch added to mm-new branch Andrew Morton
@ 2026-03-02 21:08 ` David Hildenbrand (Arm)
  2026-03-02 22:09   ` Andrew Morton
  2026-03-03  0:06 ` Matthew Wilcox
  1 sibling, 1 reply; 5+ messages in thread
From: David Hildenbrand (Arm) @ 2026-03-02 21:08 UTC (permalink / raw)
  To: Andrew Morton, mm-commits, willy, peterx, joshua.hahnjy, jhubbard,
	jgg, dywoq.contact, aleks.koyf

On 3/2/26 21:43, Andrew Morton wrote:
> The patch titled
>      Subject: mm: initialize 'seq' in gup_fast to remove -Wmaybe-uninitialized warning
> has been added to the -mm mm-new branch.  Its filename is
>      mm-initialize-seq-in-gup_fast-to-remove-wmaybe-uninitialized-warning.patch
> 
> This patch will shortly appear at
>      https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-initialize-seq-in-gup_fast-to-remove-wmaybe-uninitialized-warning.patch
> 
> This patch will later appear in the mm-new branch at
>     git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
> 
> Note, mm-new is a provisional staging ground for work-in-progress
> patches, and acceptance into mm-new is a notification for others take
> notice and to finish up reviews.  Please do not hesitate to respond to
> review feedback and post updated versions to replace or incrementally
> fixup patches in mm-new.
> 
> The mm-new branch of mm.git is not included in linux-next
> 
> Before you just go and hit "reply", please:
>    a) Consider who else should be cc'ed
>    b) Prefer to cc a suitable mailing list as well
>    c) Ideally: find the original patch on the mailing list and do a
>       reply-to-all to that, adding suitable additional cc's
> 
> *** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
> 
> The -mm tree is included into linux-next via various
> branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
> and is updated there most days
> 
> ------------------------------------------------------
> From: Alexey Suchkov <aleks.koyf@gmail.com>
> Subject: mm: initialize 'seq' in gup_fast to remove -Wmaybe-uninitialized warning
> Date: Mon, 2 Mar 2026 22:34:05 +0300
> 
> 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.
> 
> Link: https://lkml.kernel.org/r/20260302193405.37961-1-dywoq.contact@gmail.com
> Signed-off-by: Alexey Suchkov <dywoq.contact@gmail.com>
> Cc: David Hildenbrand <david@kernel.org>
> Cc: Jason Gunthorpe <jgg@ziepe.ca>
> Cc: John Hubbard <jhubbard@nvidia.com>
> Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
> Cc: Peter Xu <peterx@redhat.com>
> Cc: Joshua Hahn <joshua.hahnjy@gmail.com>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> ---
> 
>  mm/gup.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> --- a/mm/gup.c~mm-initialize-seq-in-gup_fast-to-remove-wmaybe-uninitialized-warning
> +++ a/mm/gup.c
> @@ -3131,7 +3131,7 @@ static unsigned long gup_fast(unsigned l
>  {
>  	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))

Odd, because raw_seqcount_try_begin() does as a first thing

	start = raw_read_seqcount(s);

I don't seem to get the warnings on "gcc (Debian 15.2.0-14) 15.2.0".


But certainly does not hurt.

Acked-by: David Hildenbrand (Arm) <david@kernel.org>

-- 
Cheers,

David

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: + mm-initialize-seq-in-gup_fast-to-remove-wmaybe-uninitialized-warning.patch added to mm-new branch
  2026-03-02 21:08 ` David Hildenbrand (Arm)
@ 2026-03-02 22:09   ` Andrew Morton
  0 siblings, 0 replies; 5+ messages in thread
From: Andrew Morton @ 2026-03-02 22:09 UTC (permalink / raw)
  To: David Hildenbrand (Arm)
  Cc: mm-commits, willy, peterx, joshua.hahnjy, jhubbard, jgg,
	dywoq.contact, aleks.koyf

On Mon, 2 Mar 2026 22:08:44 +0100 "David Hildenbrand (Arm)" <david@kernel.org> wrote:

> > --- a/mm/gup.c~mm-initialize-seq-in-gup_fast-to-remove-wmaybe-uninitialized-warning
> > +++ a/mm/gup.c
> > @@ -3131,7 +3131,7 @@ static unsigned long gup_fast(unsigned l
> >  {
> >  	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))
> 
> Odd, because raw_seqcount_try_begin() does as a first thing
> 
> 	start = raw_read_seqcount(s);

gcc has always had problems with

	if (something)
		initialize
	...
	if (same thing)
		use

> I don't seem to get the warnings on "gcc (Debian 15.2.0-14) 15.2.0".

Neither do I.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: + mm-initialize-seq-in-gup_fast-to-remove-wmaybe-uninitialized-warning.patch added to mm-new branch
  2026-03-02 20:43 + mm-initialize-seq-in-gup_fast-to-remove-wmaybe-uninitialized-warning.patch added to mm-new branch Andrew Morton
  2026-03-02 21:08 ` David Hildenbrand (Arm)
@ 2026-03-03  0:06 ` Matthew Wilcox
  2026-03-03  0:14   ` Andrew Morton
  1 sibling, 1 reply; 5+ messages in thread
From: Matthew Wilcox @ 2026-03-03  0:06 UTC (permalink / raw)
  To: Andrew Morton
  Cc: mm-commits, peterx, joshua.hahnjy, jhubbard, jgg, dywoq.contact,
	david, aleks.koyf

On Mon, Mar 02, 2026 at 12:43:09PM -0800, Andrew Morton wrote:
> The patch titled
>      Subject: mm: initialize 'seq' in gup_fast to remove -Wmaybe-uninitialized warning
> has been added to the -mm mm-new branch.  Its filename is
>      mm-initialize-seq-in-gup_fast-to-remove-wmaybe-uninitialized-warning.patch

This was a W=2 warning.  We don't usually fix those.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: + mm-initialize-seq-in-gup_fast-to-remove-wmaybe-uninitialized-warning.patch added to mm-new branch
  2026-03-03  0:06 ` Matthew Wilcox
@ 2026-03-03  0:14   ` Andrew Morton
  0 siblings, 0 replies; 5+ messages in thread
From: Andrew Morton @ 2026-03-03  0:14 UTC (permalink / raw)
  To: Matthew Wilcox
  Cc: mm-commits, peterx, joshua.hahnjy, jhubbard, jgg, dywoq.contact,
	david, aleks.koyf

On Tue, 3 Mar 2026 00:06:15 +0000 Matthew Wilcox <willy@infradead.org> wrote:

> On Mon, Mar 02, 2026 at 12:43:09PM -0800, Andrew Morton wrote:
> > The patch titled
> >      Subject: mm: initialize 'seq' in gup_fast to remove -Wmaybe-uninitialized warning
> > has been added to the -mm mm-new branch.  Its filename is
> >      mm-initialize-seq-in-gup_fast-to-remove-wmaybe-uninitialized-warning.patch
> 
> This was a W=2 warning.  We don't usually fix those.

yeah.

I thought there was a more recognized way of enabling this, but it
seems I dreamed it.

otoh, there's value in having people privately testing W=2 - they might
find bugs, so making life better for those people also has value.  It
depends how much other noise the W=2 build creates.

<tries it>

./arch/x86/include/asm/text-patching.h: In function '__emulate_cc':
./arch/x86/include/asm/text-patching.h:183:36: error: declaration of 'cc_mask' s

immediate fail.   How are people even using this thing?

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-03-03  0:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-02 20:43 + mm-initialize-seq-in-gup_fast-to-remove-wmaybe-uninitialized-warning.patch added to mm-new branch Andrew Morton
2026-03-02 21:08 ` David Hildenbrand (Arm)
2026-03-02 22:09   ` Andrew Morton
2026-03-03  0:06 ` Matthew Wilcox
2026-03-03  0:14   ` Andrew Morton

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.