Skip to contentSkip to conversation

writeback: Avoid uninitialized variable warning

PATCH New Jan Kara 1 participant 1 message Sep 18, 2025 VFS

lore
Share & tools
lore

Jan Kara

author reviewer
#0 lore raw

PATCH 1/1 writeback: Avoid uninitialized variable warning

Smatch reports that 'new_wb' in cleanup_offline_cgwb() can be used uninitialized. This is actually not true as root cgroup never gets offlined and other cgroups have a parent but still it's reasonable defensive programming to have new_wb initialized to NULL.

---
 fs/fs-writeback.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Christian, please either merge this patch or fold it into 67c312b4e9bf ("writeback: Avoid contention on wb->list_lock when switching inodes") in your tree. Thanks!

fs/fs-writeback.c +1 -1
index c1b20ac94e3f..dd4930d2e9e6 100644
@@ -709,7 +709,7 @@ bool cleanup_offline_cgwb(struct bdi_writeback *wb)
 {
 	struct cgroup_subsys_state *memcg_css;
 	struct inode_switch_wbs_context *isw;
-	struct bdi_writeback *new_wb;
+	struct bdi_writeback *new_wb = NULL;
 	int nr;
 	bool restart = false;
 
Signature · 1 line
2.51.0