All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: lirongqing <lirongqing@baidu.com>, linux-rdma@vger.kernel.org
Subject: Re: [PATCH v3] RDMA/mlx5: Fix CQ resize destination index mask
Date: Mon, 19 Oct 2026 05:10:31 +0000	[thread overview]
Message-ID: <sashiko-outbox-176660@kernel.org> (raw)
In-Reply-To: <20261019050503.2313-1-lirongqing@baidu.com>

> From: Li RongQing <lirongqing@baidu.com>
> 
> In copy_resize_cqes, the destination CQE index is computed as
> (i + 1) & cq->resize_buf->nent, but resize_buf->nent is produced by
> roundup_pow_of_two(), so it is a power of two with exactly one bit set.
> Masking with a single-bit value can only yield 0 or nent itself. The
> buffer has nent entries, so valid indices are 0 .. nent - 1 and nent is
> one past the last slot; whenever the masked result is nent the following
> memcpy writes one entry out of bounds.
> 
> Use (nent - 1) as the wrap mask instead. For a power-of-two nent,
> (i + 1) & (nent - 1) is the correct modulo-nent reduction, keeping the
> index within [0, nent - 1]. This matches get_sw_cqe(), which addresses
> the CQ buffer via n & cq->ibcq.cqe, where cq->ibcq.cqe == entries - 1 is
> exactly the nent - 1 wrap mask.
> 
> Fixes: bde51583f49b ("IB/mlx5: Add support for resize CQ")
> Signed-off-by: Li RongQing <lirongqing@baidu.com>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261019050503.2313-1-lirongqing@baidu.com?part=1


  reply	other threads:[~2026-10-19  5:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-19  5:05 [PATCH v3] RDMA/mlx5: Fix CQ resize destination index mask lirongqing
2026-10-19  5:10 ` sashiko-bot [this message]
2026-10-20  7:28 ` Leon Romanovsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sashiko-outbox-176660@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=lirongqing@baidu.com \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.