libkvm: fix kvm_walk_pages
Correct bitmap operations in _kvm_bitmap_next. Reviewed by: jhb MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D19183
This commit is contained in:
parent
4dbc7835cd
commit
08055452cb
@ -792,8 +792,8 @@ _kvm_bitmap_next(struct kvm_bitmap *bm, u_long *idx)
|
||||
|
||||
/* Find the next valid idx. */
|
||||
for (; *idx < first_invalid; (*idx)++) {
|
||||
unsigned int mask = *idx % CHAR_BIT;
|
||||
if ((bm->map[*idx * CHAR_BIT] & mask) == 0)
|
||||
unsigned int mask = 1U << (*idx % CHAR_BIT);
|
||||
if ((bm->map[*idx / CHAR_BIT] & mask) != 0)
|
||||
break;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user