Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/uvm Avoid overflow if a very large number of pages are s...
details: https://anonhg.NetBSD.org/src/rev/edf292b96454
branches: trunk
changeset: 932501:edf292b96454
user: riastradh <riastradh%NetBSD.org@localhost>
date: Sat May 09 22:00:48 2020 +0000
description:
Avoid overflow if a very large number of pages are swapped at once.
Unlikely, but let's make sure we don't hit this ever.
diffstat:
sys/uvm/uvm_swap.c | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
diffs (37 lines):
diff -r 634a0a92aa4a -r edf292b96454 sys/uvm/uvm_swap.c
--- a/sys/uvm/uvm_swap.c Sat May 09 21:50:39 2020 +0000
+++ b/sys/uvm/uvm_swap.c Sat May 09 22:00:48 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uvm_swap.c,v 1.187 2020/05/09 21:50:39 riastradh Exp $ */
+/* $NetBSD: uvm_swap.c,v 1.188 2020/05/09 22:00:48 riastradh Exp $ */
/*
* Copyright (c) 1995, 1996, 1997, 2009 Matthew R. Green
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_swap.c,v 1.187 2020/05/09 21:50:39 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_swap.c,v 1.188 2020/05/09 22:00:48 riastradh Exp $");
#include "opt_uvmhist.h"
#include "opt_compat_netbsd.h"
@@ -1872,7 +1872,7 @@
s -= sdp->swd_drumoffset;
KASSERT(s < sdp->swd_drumsize);
uvm_swap_encrypt(sdp,
- (void *)(kva + i*PAGE_SIZE), s);
+ (void *)(kva + (vsize_t)i*PAGE_SIZE), s);
setbit(sdp->swd_encmap, s);
}
} else {
@@ -1967,7 +1967,8 @@
KASSERT(s < sdp->swd_drumsize);
if (isclr(sdp->swd_encmap, s))
continue;
- uvm_swap_decrypt(sdp, (void *)(kva + i*PAGE_SIZE), s);
+ uvm_swap_decrypt(sdp,
+ (void *)(kva + (vsize_t)i*PAGE_SIZE), s);
}
} while (0);
Home |
Main Index |
Thread Index |
Old Index