projects
/
pintos-anon
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
cfbade2
)
Prevent bitmap_scan() from assert-failing if CNT is greater than the
author
Ben Pfaff
<blp@cs.stanford.edu>
Fri, 5 Nov 2004 23:12:11 +0000
(23:12 +0000)
committer
Ben Pfaff
<blp@cs.stanford.edu>
Fri, 5 Nov 2004 23:12:11 +0000
(23:12 +0000)
bitmap's size.
src/lib/kernel/bitmap.c
patch
|
blob
|
history
diff --git
a/src/lib/kernel/bitmap.c
b/src/lib/kernel/bitmap.c
index cacc263a200b5fea1dc440afdc3249788681567f..95d689034617917f9cd23ef7b5423978fa774cec 100644
(file)
--- a/
src/lib/kernel/bitmap.c
+++ b/
src/lib/kernel/bitmap.c
@@
-216,9
+216,10
@@
bitmap_scan (const struct bitmap *b, size_t start, size_t cnt, bool value)
ASSERT (b != NULL);
ASSERT (start <= b->bit_cnt);
- for (idx = start, last = b->bit_cnt - cnt; idx <= last; idx++)
- if (!contains (b, idx, idx + cnt, !value))
- return idx;
+ if (cnt <= b->bit_cnt)
+ for (idx = start, last = b->bit_cnt - cnt; idx <= last; idx++)
+ if (!contains (b, idx, idx + cnt, !value))
+ return idx;
return BITMAP_ERROR;
}