All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Edward Srouji" <edwards@nvidia.com>
Cc: linux-rdma@vger.kernel.org
Subject: Re: [PATCH rdma-next 4/4] RDMA/hns: Use unsigned comparison in the CQ cleanup loop
Date: Tue, 15 Sep 2026 15:44:36 +0000	[thread overview]
Message-ID: <20260915154437.303811F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260915-fix-cq-cleanup-v1-4-e991944cf898@nvidia.com>

> From: Yishai Hadas <yishaih@nvidia.com>
> 
> __hns_roce_v2_cq_clean() sweeps the CQ backwards from the producer
> index down to the consumer index:
> 
>   while ((int) --prod_index - (int) hr_cq->cons_index >= 0)
> 
> Both indexes are free running u32 counters, so the comparison has to
> be done modulo 2^32.  Casting each operand to int and subtracting
> does not do that: the subtraction overflows whenever the two indexes
> straddle 2^31, which is undefined behaviour, and a compiler that
> assumes signed overflow cannot occur is free to discard the
> subtraction and fold the expression into a plain signed comparison.
> That comparison is not wraparound safe.
> 
> [ ... ]
> of whether either counter has wrapped, because the loop no longer
> compares magnitudes at all.
> 
> Signed-off-by: Yishai Hadas <yishaih@nvidia.com>
> Signed-off-by: Edward Srouji <edwards@nvidia.com>

Sashiko has reviewed this patch and found no issues. It looks great!

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260915-fix-cq-cleanup-v1-0-e991944cf898@nvidia.com?part=4


  reply	other threads:[~2026-09-15 15:44 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-15 15:33 [PATCH rdma-next 0/4] RDMA: Use unsigned comparison in CQ cleanup loops Edward Srouji
2026-09-15 15:33 ` [PATCH rdma-next 1/4] RDMA/mlx5: Use unsigned comparison in the CQ cleanup loop Edward Srouji
2026-09-15 15:43   ` sashiko-bot
2026-09-15 15:33 ` [PATCH rdma-next 2/4] RDMA/mlx4: " Edward Srouji
2026-09-15 15:43   ` sashiko-bot
2026-09-15 15:33 ` [PATCH rdma-next 3/4] RDMA/mthca: " Edward Srouji
2026-09-15 15:41   ` sashiko-bot
2026-09-15 15:33 ` [PATCH rdma-next 4/4] RDMA/hns: " Edward Srouji
2026-09-15 15:44   ` sashiko-bot [this message]
2026-09-22 13:15 ` [PATCH rdma-next 0/4] RDMA: Use unsigned comparison in CQ cleanup loops 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=20260915154437.303811F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=edwards@nvidia.com \
    --cc=linux-rdma@vger.kernel.org \
    --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.