x86: Fix integer overflow in pml_for_each()
authorBarret Rhoden <brho@cs.berkeley.edu>
Mon, 28 Nov 2016 03:14:33 +0000 (22:14 -0500)
committerBarret Rhoden <brho@cs.berkeley.edu>
Tue, 29 Nov 2016 16:27:40 +0000 (11:27 -0500)
commitadd6d0e319ddc887301e4036fff256e8fab56c52
tree1ff9a0fd53805108a62fd1dca6a95b17f898203e
parent22278d2c2a5fbf548b5a48f334d3da02e0786812
x86: Fix integer overflow in pml_for_each()

If kva + pgsize wrapped around and was 0, it'd wrongly be the MIN when
compared to start + len.  We need to subtract the sub_start before
comparing with MIN() to 'undo' the temporary overflow in the size
calculation.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
kern/arch/x86/pmap64.c