aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorNicholas Piggin <npiggin@gmail.com>2017-11-25 06:07:59 +1000
committerStewart Smith <stewart@linux.vnet.ibm.com>2017-11-27 18:49:58 +1100
commit2df2407375963ab08bcb3c62eb7230c07e734687 (patch)
tree78cc41c08cefc5a815626c48c4141c4a38cd20cd /include
parent0aa749e6822aee816b4a9c3100eebabc2e74ee32 (diff)
downloadskiboot-2df2407375963ab08bcb3c62eb7230c07e734687.zip
skiboot-2df2407375963ab08bcb3c62eb7230c07e734687.tar.gz
skiboot-2df2407375963ab08bcb3c62eb7230c07e734687.tar.bz2
core/bitmap: fix bitmap iteration limit corruption
The bitmap iterators did not reduce the number of bits to scan when searching for the next bit, which would result in them overruning their bitmap. These are only used in one place, in xive reset, and the effect is that the xive reset code will keep zeroing memory until it reaches a block of memory of MAX_EQ_COUNT >> 3 bits in length, all zeroes. Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'include')
-rw-r--r--include/bitmap.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/include/bitmap.h b/include/bitmap.h
index 12913ea..f3510f7 100644
--- a/include/bitmap.h
+++ b/include/bitmap.h
@@ -59,11 +59,11 @@ extern int bitmap_find_one_bit(bitmap_t map, unsigned int start,
#define bitmap_for_each_zero(map, size, bit) \
for (bit = bitmap_find_zero_bit(map, 0, size); \
bit >= 0; \
- bit = bitmap_find_zero_bit(map, bit + 1, size))
+ bit = bitmap_find_zero_bit(map, (bit) + 1, (size) - (bit) - 1))
#define bitmap_for_each_one(map, size, bit) \
for (bit = bitmap_find_one_bit(map, 0, size); \
bit >= 0; \
- bit = bitmap_find_one_bit(map, bit + 1, size))
+ bit = bitmap_find_one_bit(map, (bit) + 1, (size) - (bit) - 1))
#endif /* __BITMAP_H */