providers/rxe: Replace '%' with '&' in check_qp_queue_full()
PATCH v2 1/1 providers/rxe: Replace '%' with '&' in check_qp_queue_full()
The expression "cons == ((qp->cur_index + 1) % q->index_mask)" doesn't check the state of queue (full or empty) correctly. For example:
If cons and qp->cur_index are 0 and q->index_mask is 1, the queue is actually empty but check_qp_queue_full() reports full (ENOSPC).
--- providers/rxe/rxe_queue.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
providers/rxe/rxe_queue.h +1 -1
@@ -205,7 +205,7 @@ static inline int check_qp_queue_full(struct rxe_qp *qp)if (qp->err) goto err; -if (cons == ((qp->cur_index +1 ) % q->index_mask)) +if (cons == ((qp->cur_index +1 ) & q->index_mask)) qp->err =ENOSPC ; err:return qp->err;
Signature · 1 line
2.25.1
Quoted 17 lines · Xiao Yang
The expression "cons == ((
qp->cur_index+ 1) %q->index_mask)" doesn't check the state of queue (full or empty) correctly. For example:
If cons andqp->cur_indexare 0 andq->index_maskis 1, the queue is actually empty butcheck_qp_queue_full()reports full (ENOSPC).Fixes 1a894ca10105 ("Providers/rxe: Implement ibv_create_qp_ex verb")Signed-off-by Xiao Yang <[email protected]>--- providers/rxe/rxe_queue.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)providers/rxe/rxe_queue.h +0
-0
providers/rxe/rxe_queue.h static inline int check_qp_queue_full(struct rxe_qp *qp) · line 211
Quoted 8 lines
providers/rxe/rxe_queue.h +1
-1@@ -205,7 +205,7 @@ static inline int check_qp_queue_full(struct rxe_qp *qp)if (qp->err) goto err; -if (cons == ((qp->cur_index +1 ) % q->index_mask)) +if (cons == ((qp->cur_index +1 ) & q->index_mask)) qp->err =ENOSPC ; err:return qp->err;
This is fine.
Leon Romanovsky
AppliedQuoted 11 lines · Xiao Yang
The expression "cons == ((
qp->cur_index+ 1) %q->index_mask)" doesn't check the state of queue (full or empty) correctly. For example:
If cons andqp->cur_indexare 0 andq->index_maskis 1, the queue is actually empty butcheck_qp_queue_full()reports full (ENOSPC).Fixes 1a894ca10105 ("Providers/rxe: Implement ibv_create_qp_ex verb")Signed-off-by Xiao Yang <[email protected]>--- providers/rxe/rxe_queue.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Thanks, applied.