Drive the deref loop by get_remaining() >= step instead of comparing to
end(), so a total length that is not a multiple of step no longer lets
`iter += step` run past the end and throw "End of buffer".
The original counts were always a multiple of step, so the overrun only
showed up once the following commit shrinks the rounds under ASan -- a
false alarm rather than a real regression, which is why it went unnoticed
until now.
Signed-off-by: Sun Yuechi <sunyuechi@iscas.ac.cn>
utime_t start = ceph_clock_now();
bufferlist::iterator iter = bl.begin();
- while (iter != bl.end()) {
+ while (iter.get_remaining() >= step) {
iter += step;
}
utime_t end = ceph_clock_now();