lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250325194920.53307-1-purvayeshi550@gmail.com>
Date: Wed, 26 Mar 2025 01:19:20 +0530
From: Purva Yeshi <purvayeshi550@...il.com>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: linux-mm@...ck.org,
	linux-kernel@...r.kernel.org,
	Purva Yeshi <purvayeshi550@...il.com>
Subject: [PATCH] mm/vmscan: Initialize dirty to prevent uninitialized use

Fix Smatch-detected error:
mm/vmscan.c:3509 walk_pte_range() error: uninitialized symbol 'dirty'.
mm/vmscan.c:3522 walk_pte_range() error: uninitialized symbol 'dirty'.
mm/vmscan.c:3600 walk_pmd_range_locked() error: uninitialized symbol 'dirty'.
mm/vmscan.c:3614 walk_pmd_range_locked() error: uninitialized symbol 'dirty'.
mm/vmscan.c:4220 lru_gen_look_around() error: uninitialized symbol 'dirty'.
mm/vmscan.c:4232 lru_gen_look_around() error: uninitialized symbol 'dirty'.

Smatch reports 'dirty' as uninitialized, leading to potential
undefined behavior.

Explicitly initialize dirty to 0 in walk_pte_range(),
walk_pmd_range_locked(), and lru_gen_look_around() in mm/vmscan.c
to fix Smatch error.

Signed-off-by: Purva Yeshi <purvayeshi550@...il.com>
---
 mm/vmscan.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/mm/vmscan.c b/mm/vmscan.c
index c767d71c43d7..39c49fcd960c 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -3456,7 +3456,7 @@ static bool walk_pte_range(pmd_t *pmd, unsigned long start, unsigned long end,
 			   struct mm_walk *args)
 {
 	int i;
-	bool dirty;
+	bool dirty = 0;
 	pte_t *pte;
 	spinlock_t *ptl;
 	unsigned long addr;
@@ -3535,7 +3535,7 @@ static void walk_pmd_range_locked(pud_t *pud, unsigned long addr, struct vm_area
 				  struct mm_walk *args, unsigned long *bitmap, unsigned long *first)
 {
 	int i;
-	bool dirty;
+	bool dirty = 0;
 	pmd_t *pmd;
 	spinlock_t *ptl;
 	struct folio *last = NULL;
@@ -4147,7 +4147,7 @@ static void lru_gen_age_node(struct pglist_data *pgdat, struct scan_control *sc)
 bool lru_gen_look_around(struct page_vma_mapped_walk *pvmw)
 {
 	int i;
-	bool dirty;
+	bool dirty = 0;
 	unsigned long start;
 	unsigned long end;
 	struct lru_gen_mm_walk *walk;
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ