Skip to contentSkip to conversation

netfs: Fix a KMSAN uninit-value error in netfs_clear_buffer

PATCH Applied Chang Yu 3 participants 3 messages Oct 1, 2024

Subsystems (2)
lore
Share & tools
lore

Chang Yu

author
#0 lore raw

PATCH v2 1/1 netfs: Fix a KMSAN uninit-value error in netfs_clear_buffer

Use folioq_count instead of folioq_nr_slots to fix a KMSAN uninit-value error in netfs_clear_buffer

Reported-by [email protected]
Fixes cd0277ed0c18 ("netfs: Use new folio_queue data type and iterator instead of xarray iter")

---
Changes since v2:
- Use folioq_count when putting pointers. This avoids touching uninitialized pointer and is a deeper fix than just using kzalloc.

 fs/netfs/misc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/netfs/misc.c +1 -1
index 63280791de3b..78fe5796b2b2 100644
@@ -102,7 +102,7 @@ void netfs_clear_buffer(struct netfs_io_request *rreq)
 
 	while ((p = rreq->buffer)) {
 		rreq->buffer = p->next;
-		for (int slot = 0; slot < folioq_nr_slots(p); slot++) {
+		for (int slot = 0; slot < folioq_count(p); slot++) {
 			struct folio *folio = folioq_folio(p, slot);
 			if (!folio)
 				continue;
Signature · 1 line
2.46.2
maintainer Acked-by on v2 1/1
#1 lore raw
Quoted 7 lines · Chang Yu

Use folioq_count instead of folioq_nr_slots to fix a KMSAN uninit-value error in netfs_clear_buffer

Reported-by [email protected]
Fixes cd0277ed0c18 ("netfs: Use new folio_queue data type and iterator instead of xarray iter")

Christian: Can you pick this up?

maintainer Applied
#2 lore raw
In reply to Chang Yu
Quoted 4 lines · Chang Yu

Use folioq_count instead of folioq_nr_slots to fix a KMSAN uninit-value error in netfs_clear_buffer

Applied to the vfs.fixes branch of the vfs/vfs.git tree. Patches in the vfs.fixes branch should appear in linux-next soon.

Please report any outstanding bugs that were missed during review in a new review to the original patch series allowing us to drop it.

It's encouraged to provide Acked-bys and Reviewed-bys even though the patch has now been applied. If possible patch trailers will be updated.

Note that commit hashes shown below are subject to change due to rebase, trailer updates or similar. If in doubt, please check the listed branch.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git
branch: vfs.fixes

[1/1] netfs: Fix a KMSAN uninit-value error in netfs_clear_buffer

      https://git.kernel.org/vfs/vfs/c/f6023535b52f