Skip to contentSkip to conversation

mm-vmscan-avoid-false-positive-wuninitialized-warning.patch removed from -mm tree

merged mm-stable Andrew Morton 1 participant 1 message Apr 18

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: mm/vmscan: avoid false-positive -Wuninitialized warning
has been removed from the -mm tree. Its filename was
mm-vmscan-avoid-false-positive-wuninitialized-warning.patch

This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: Arnd Bergmann <[email protected]>
Subject: mm/vmscan: avoid false-positive -Wuninitialized warning
Date: Tue, 14 Apr 2026 08:51:58 +0200

When the -fsanitize=bounds sanitizer is enabled, gcc-16 sometimes runs into a corner case in the read_ctrl_pos() pos function, where it sees possible undefined behavior from the 'tier' index overflowing, presumably in the case that this was called with a negative tier:

In function 'get_tier_idx',

    inlined from 'isolate_folios' at mm/vmscan.c:4671:14:

mm/vmscan.c: In function 'isolate_folios':
mm/vmscan.c:4645:29: error: 'pv.refaulted' is used uninitialized [-Werror=uninitialized]

Part of the problem seems to be that read_ctrl_pos() has unusual calling conventions since commit 37a260870f2c ("mm/mglru: rework type selection") where passing MAX_NR_TIERS makes it accumulate all tiers but passing a smaller positive number makes it read a single tier instead.

Shut up the warning by adding a fake initialization to the two instances of this variable that can run into that corner case.

---

 mm/vmscan.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
mm/vmscan.c renamed from mm/vmscan.c~mm-vmscan-avoid-false-positive-wuninitialized-warning +2 -2
@@ -4760,7 +4760,7 @@ static int scan_folios(unsigned long nr_
 static int get_tier_idx(struct lruvec *lruvec, int type)
 {
 	int tier;
-	struct ctrl_pos sp, pv;
+	struct ctrl_pos sp, pv = {};
 
 	/*
 	 * To leave a margin for fluctuations, use a larger gain factor (2:3).
@@ -4779,7 +4779,7 @@ static int get_tier_idx(struct lruvec *l
 
 static int get_type_to_scan(struct lruvec *lruvec, int swappiness)
 {
-	struct ctrl_pos sp, pv;
+	struct ctrl_pos sp, pv = {};
 
 	if (swappiness <= MIN_SWAPPINESS + 1)
 		return LRU_GEN_FILE;

_

Patches currently in -mm which might be from [email protected] are