[PATCH] [PATCH v2] mm: initialize 'seq' in gup_fast to remove -Wmaybe-uninitialized warning
From: Alexey Suchkov
Date: Mon Mar 02 2026 - 14:34:38 EST
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.
Changes since v1:
- Removes the accidental formatting from v1.
Signed-off-by: Alexey Suchkov <dywoq.contact@xxxxxxxxx>
---
mm/gup.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mm/gup.c b/mm/gup.c
index 8e7dc2c6e..879798de5 100644
--- 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))
--
2.53.0