Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions fabtests/common/shared.c
Original file line number Diff line number Diff line change
Expand Up @@ -2767,6 +2767,12 @@ static int ft_spin_for_comp(struct fid_cq *cq, uint64_t *cur,
if (timeout >= 0)
clock_gettime(CLOCK_MONOTONIC, &a);

/*
* Callers must ensure *cur < total; calling with *cur >= total
* is a bug because the do...while loop always executes at least
* once and can increment *cur causing an underflow in the
* loop condition.
*/
do {
ret = fi_cq_read(cq, &comp, 1);
if (ret > 0) {
Expand Down
Loading