summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2023-12-05 15:50:46 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2023-12-05 15:50:46 +0000
commitd2cb1ec7d52296a183be036f327e618014f7d54c (patch)
tree9b9e28b34c878a20152d9c3a6da37a61a23a7568 /sys
parent79736608a5b930f9b190de0f371f9a60e325a7f0 (diff)
Cast uvmexp.swpages to long before multiplying by 99 to avoid integer
overflows on systems with big swap partitions. OK kettenis@ miod@
Diffstat (limited to 'sys')
-rw-r--r--sys/uvm/uvm_swap.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/uvm/uvm_swap.c b/sys/uvm/uvm_swap.c
index 1818cc06384..02fe95fbb6b 100644
--- a/sys/uvm/uvm_swap.c
+++ b/sys/uvm/uvm_swap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_swap.c,v 1.167 2023/10/27 19:18:53 mpi Exp $ */
+/* $OpenBSD: uvm_swap.c,v 1.168 2023/12/05 15:50:45 claudio Exp $ */
/* $NetBSD: uvm_swap.c,v 1.40 2000/11/17 11:39:39 mrg Exp $ */
/*
@@ -1548,7 +1548,7 @@ uvm_swapisfull(void)
mtx_enter(&uvm_swap_data_lock);
KASSERT(uvmexp.swpgonly <= uvmexp.swpages);
- result = (uvmexp.swpgonly >= (uvmexp.swpages * 99 / 100));
+ result = (uvmexp.swpgonly >= ((long)uvmexp.swpages * 99 / 100));
mtx_leave(&uvm_swap_data_lock);
return result;