Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

Signed-off-by: Chang Yu <marcus.yu.56@gmail.com>
Link: https://lore.kernel.org/r/ZvuXWC2bYpvQsWgS@gmail.com
Fixes: cd0277ed0c18 ("netfs: Use new folio_queue data type and iterator instead of xarray iter")
Acked-by: David Howells <dhowells@redhat.com>
Reported-by: syzbot+921873345a95f4dae7e9@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=921873345a95f4dae7e9
Signed-off-by: Christian Brauner <brauner@kernel.org>

authored by

Chang Yu and committed by
Christian Brauner
f6023535 0d24852b

+1 -1
+1 -1
fs/netfs/misc.c
··· 102 102 103 103 while ((p = rreq->buffer)) { 104 104 rreq->buffer = p->next; 105 - for (int slot = 0; slot < folioq_nr_slots(p); slot++) { 105 + for (int slot = 0; slot < folioq_count(p); slot++) { 106 106 struct folio *folio = folioq_folio(p, slot); 107 107 if (!folio) 108 108 continue;