Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Yanze Zhang" <zhang.yanze@zte.com.cn>
Cc: linux-rdma@vger.kernel.org
Subject: Re: [PATCH rdma v8 2/7] RDMA/zrdma: Add core data structures and ABI definitions
Date: Mon, 02 Nov 2026 08:55:06 +0000	[thread overview]
Message-ID: <sashiko-outbox-193142@kernel.org> (raw)
In-Reply-To: <20261102082026.2645777-3-zhang.yanze@zte.com.cn>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] RDMA/zrdma: private untyped auxiliary device contract in zrdma_type.h
--

commit 8cc318d7731f01390658d794db981381eb4bcc2c
Author: Yanze Zhang <zhang.yanze@zte.com.cn>

RDMA/zrdma: Add core data structures and ABI definitions

This commit adds core data structures, hardware control definitions, and the
userspace ABI header for the ZTE DingHai RDMA driver.

> diff --git a/drivers/infiniband/hw/zrdma/zrdma_type.h b/drivers/infiniband/hw/zrdma/zrdma_type.h
> new file mode 100644
> index 0000000000000..ded4052453455
> --- /dev/null
> +++ b/drivers/infiniband/hw/zrdma/zrdma_type.h
> @@ -0,0 +1,86 @@
[ ... ]
> +struct zxdh_rdma_core_dev;
> +
> +struct zxdh_rdma_core_ops {
> +	int (*request_reset)(struct zxdh_rdma_core_dev *cdev,
> +			     enum zxdh_rdma_reset_type reset_type);
> +	int (*zxdh_common_func)(void *in_param, void *out_param, u32 opcode);
> +};
[ ... ]
> +struct zxdh_rdma_core_dev {
> +	struct pci_dev *pdev;
> +	struct auxiliary_device *adev;
> +	u8 __iomem *hw_addr;
> +	int zdev_info_id;
> +	struct zxdh_rdma_ver_info ver;
> +	void *auxiliary_priv;
> +	enum zxdh_function_type ftype;
> +	u16 vport_id;
> +	u16 slot_id;
> +	enum zxdh_rdma_protocol rdma_protocol;
> +
> +	struct zxdh_qos_params qos_info;
> +	struct msix_entry *msix_entries;
> +	u16 msix_count;
> +	const struct zxdh_rdma_core_ops *ops;
> +	void *dh_dev;
> +};
> +
> +struct zxdh_rdma_if {
> +	void *(*get_rdma_netdev)(void *dh_dev);
> +};
> +
> +struct zxdh_auxiliary_dev {
> +	struct auxiliary_device adev;
> +	struct zxdh_rdma_core_dev *zxdh_info;
> +	struct zxdh_rdma_if *rdma_ops;
> +	void *ops;
> +	void *parent;
> +	s32 aux_id;
> +	void *auxiliary_ops[18];
> +};

[Severity: Medium]
Should struct zxdh_auxiliary_dev, struct zxdh_rdma_core_dev,
struct zxdh_rdma_core_ops, and struct zxdh_rdma_if be defined with full
concrete types in a shared header under include/linux/ that both the parent
PCI PF driver and this RDMA auxiliary driver include, rather than in a
driver-private RDMA header?

In the subsequent patch "RDMA/zrdma: Add device probe and remove logic",
zxdh_probe() binds to the dinghai10e.rdma_aux auxiliary device, converts
struct auxiliary_device *aux_dev via container_of(aux_dev,
struct zxdh_auxiliary_dev, adev), and calls
zxdh_adev->rdma_ops->get_rdma_netdev(zxdh_adev->parent) and
zxdh_adev->zxdh_info->ops->zxdh_common_func().

Because drivers/infiniband/hw/zrdma/zrdma_type.h defines a private copy of
these structures padded with opaque placeholders such as void *ops,
void *parent, void *auxiliary_ops[18], void *dh_dev,
void *(*get_rdma_netdev)(void *dh_dev) (instead of returning
struct net_device *), and int (*zxdh_common_func)(void *in_param,
void *out_param, u32 opcode), the compiler cannot verify that the struct
layout or callback signatures match the parent PF driver. In addition, the
in-tree driver under drivers/net/ethernet/zte/dinghai/ does not appear to
define or register this auxiliary device yet.

Could this private definition cause memory corruption or invalid function
pointer calls during zxdh_probe() if the parent driver layout or signatures
diverge?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261102082026.2645777-1-zhang.yanze@zte.com.cn?part=2

  reply	other threads:[~2026-11-02  8:55 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-02  8:20 [PATCH rdma v8 0/7] Add ZTE DingHai Ethernet Protocol Driver for RDMA Yanze Zhang
2026-11-02  8:20 ` [PATCH rdma v8 1/7] RDMA/zrdma: Add build infrastructure and module skeleton Yanze Zhang
2026-11-02  8:45   ` sashiko-bot
2026-11-02  8:20 ` [PATCH rdma v8 2/7] RDMA/zrdma: Add core data structures and ABI definitions Yanze Zhang
2026-11-02  8:55   ` sashiko-bot [this message]
2026-11-02  8:20 ` [PATCH rdma v8 3/7] RDMA/zrdma: Add internal headers and hardware register definitions Yanze Zhang
2026-11-02  9:00   ` sashiko-bot
2026-11-02  8:20 ` [PATCH rdma v8 4/7] RDMA/zrdma: Add hardware resource initialization and verbs skeleton Yanze Zhang
2026-11-02  9:14   ` sashiko-bot
2026-11-02  8:20 ` [PATCH rdma v8 5/7] RDMA/zrdma: Implement device and port query operations Yanze Zhang
2026-11-02  9:31   ` sashiko-bot
2026-11-02  8:20 ` [PATCH rdma v8 6/7] RDMA/zrdma: Add device probe and remove logic Yanze Zhang
2026-11-02  9:36   ` sashiko-bot
2026-11-02  8:20 ` [PATCH rdma v8 7/7] RDMA/zrdma: Implement context, PD, and mmap operations Yanze Zhang
2026-11-02  9:47   ` 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-193142@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=zhang.yanze@zte.com.cn \
    /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