summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2026-01-17 05:30:09 +0200
committerKonstantin Belousov <kib@FreeBSD.org>2026-01-17 05:33:24 +0200
commit325baf00735756d024b903bfcee50b4f09e90129 (patch)
tree752acb415cbf2c3dbe8654a313c8f1e4cdbd0c6b /sys
parentc75eff16ef54aaae7b5dc52ed894cc73a855f469 (diff)
vm/swap_pager.c: silence compiler warning
Initialize pindex in swap_pager_getpages_locked() before the loop actually calculating it by skipping bogus pages. Compiler is worried that loop might never assign to it, which actually cannot happen. Sponsored by: The FreeBSD Foundation Fixes: d198ad51ea73bbb162336923a387f52b0b1c1f1d MFC after: 1 week
Diffstat (limited to 'sys')
-rw-r--r--sys/vm/swap_pager.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sys/vm/swap_pager.c b/sys/vm/swap_pager.c
index f6d201309349..834c757aa385 100644
--- a/sys/vm/swap_pager.c
+++ b/sys/vm/swap_pager.c
@@ -1370,7 +1370,7 @@ swap_pager_getpages_locked(struct pctrie_iter *blks, vm_object_t object,
KASSERT((object->flags & OBJ_SWAP) != 0,
("%s: object not swappable", __func__));
- for (i = 0; i < count; i++) {
+ for (pindex = 0, i = 0; i < count; i++) {
m = ma[i];
if (m != bogus_page) {
pindex = m->pindex - i;