From: sashiko-bot@kernel.org
To: "Konstantin Taranov" <kotaranov@linux.microsoft.com>
Cc: linux-rdma@vger.kernel.org
Subject: Re: [PATCH rdma-next v3 01/10] RDMA/mana_ib: Allocate and map fast-registration MRs
Date: Wed, 07 Oct 2026 15:46:55 +0000 [thread overview]
Message-ID: <sashiko-outbox-163159@kernel.org> (raw)
In-Reply-To: <20261007153330.2979799-2-kotaranov@linux.microsoft.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] rdma: brittle ALIGN() macro usage with struct size
--
commit 5c377dbd75ff20b57d34b69b57ca784c487e1850
Author: Konstantin Taranov <kotaranov@microsoft.com>
RDMA/mana_ib: Allocate and map fast-registration MRs
Implement alloc_mr and map_mr_sg for memory-registration MRs.
> diff --git a/drivers/infiniband/hw/mana/mana_ib.h b/drivers/infiniband/hw/mana/mana_ib.h
> index 9173ca64d2e1e..3098ad2c6a05c 100644
> --- a/drivers/infiniband/hw/mana/mana_ib.h
> +++ b/drivers/infiniband/hw/mana/mana_ib.h
[ ... ]
> +struct mana_fmr_mst_entry {
> + u32 reserved1;
> + u32 reserved2 : 8;
> + u32 page_size : 5;
> + u32 reserved3 : 3;
> + u32 access_right : 8;
> + u32 addr_type : 2;
> + u32 reserved4 : 6;
> + u32 reserved5[2];
> + u64 start_va;
> + u64 length;
> + u32 reserved6[8];
> +}; /* HW DATA */
> +
> +static inline u32 mana_ib_fmr_header_offset(u32 num_ptes)
> +{
> + /* the header is located after the PTEs and aligned to mst entry */
> + return ALIGN(sizeof(u64) * num_ptes, sizeof(struct mana_fmr_mst_entry));
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[Severity: Low]
Is it safe to use ALIGN() with a structure size in mana_ib_fmr_header_offset?
The ALIGN(x, a) macro strictly requires the alignment argument 'a' to be a
power of two in order to perform its bitwise masking logic correctly.
While sizeof(struct mana_fmr_mst_entry) currently evaluates to exactly 64 bytes
and works properly, using a structure's total size for alignment bounds is
brittle. If a developer later modifies the hardware structure in a way that its
size is no longer a power of two, the ALIGN() macro will compile without error
but produce silently corrupted mathematical results at runtime.
Could a constant macro defining the expected power-of-two alignment boundary be
used here instead?
> +}
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261007153330.2979799-1-kotaranov@linux.microsoft.com?part=1
next prev parent reply other threads:[~2026-10-07 15:46 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-07 15:33 [PATCH rdma-next v3 00/10] RDMA/mana_ib: Add kernel RC and fast registration support Konstantin Taranov
2026-10-07 15:33 ` [PATCH rdma-next v3 01/10] RDMA/mana_ib: Allocate and map fast-registration MRs Konstantin Taranov
2026-10-07 15:46 ` sashiko-bot [this message]
2026-10-07 15:33 ` [PATCH rdma-next v3 02/10] RDMA/mana: Create and destroy kernel RC QPs Konstantin Taranov
2026-10-07 15:50 ` sashiko-bot
2026-10-07 15:33 ` [PATCH rdma-next v3 03/10] net/mana: Extend GDMA encoding for new RDMA WQEs Konstantin Taranov
2026-10-07 15:47 ` sashiko-bot
2026-10-07 15:33 ` [PATCH rdma-next v3 04/10] RDMA/mana_ib: Maintain kernel RC QP state Konstantin Taranov
2026-10-07 15:46 ` sashiko-bot
2026-10-07 15:33 ` [PATCH rdma-next v3 05/10] RDMA/mana_ib: Post receive WRs on kernel RC QPs Konstantin Taranov
2026-10-07 15:43 ` sashiko-bot
2026-10-07 15:33 ` [PATCH rdma-next v3 06/10] RDMA/mana_ib: Post send and memory-management WRs on " Konstantin Taranov
2026-10-07 15:53 ` sashiko-bot
2026-10-07 15:33 ` [PATCH rdma-next v3 07/10] RDMA/mana_ib: Poll RC completions using PSN and FSN progress Konstantin Taranov
2026-10-07 15:48 ` sashiko-bot
2026-10-07 15:33 ` [PATCH rdma-next v3 08/10] RDMA/mana_ib: Flush and notify CQs when kernel QPs enter ERR Konstantin Taranov
2026-10-07 15:46 ` sashiko-bot
2026-10-07 15:33 ` [PATCH rdma-next v3 09/10] RDMA/mana_ib: Handle error CQEs for RC QPs Konstantin Taranov
2026-10-07 15:51 ` sashiko-bot
2026-10-07 15:33 ` [PATCH rdma-next v3 10/10] RDMA/mana_ib: Drain kernel receive and send queues Konstantin Taranov
2026-10-07 15:51 ` sashiko-bot
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-163159@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=kotaranov@linux.microsoft.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox