git: 325baf007357 - main - vm/swap_pager.c: silence compiler warning
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 17 Jan 2026 03:33:40 UTC
The branch main has been updated by kib:
URL: https://cgit.FreeBSD.org/src/commit/?id=325baf00735756d024b903bfcee50b4f09e90129
commit 325baf00735756d024b903bfcee50b4f09e90129
Author: Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2026-01-17 03:30:09 +0000
Commit: Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2026-01-17 03:33:24 +0000
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
---
sys/vm/swap_pager.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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;