[PATCH RFC] RDMA/irdma: check vport device allocation

Slavin Liu posted 1 patch 2 weeks ago
drivers/infiniband/hw/irdma/main.c | 2 ++
1 file changed, 2 insertions(+)
[PATCH RFC] RDMA/irdma: check vport device allocation
Posted by Slavin Liu 2 weeks ago
An existing RDMA function does not guarantee allocation of the new
vport device. Return -ENOMEM before initializing a NULL iwdev.

Detected by static analysis and reviewed with AI-assisted source auditing.

Fixes: 2ad49ae7330b ("RDMA/irdma: Introduce GEN3 vPort driver support")
Assisted-by: LLM
Signed-off-by: Slavin Liu <bolin.liu@seu.edu.cn>
---
 drivers/infiniband/hw/irdma/main.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/infiniband/hw/irdma/main.c b/drivers/infiniband/hw/irdma/main.c
index 95957d52883d..106915b51e7c 100644
--- a/drivers/infiniband/hw/irdma/main.c
+++ b/drivers/infiniband/hw/irdma/main.c
@@ -80,6 +80,8 @@ static int ig3rdma_vport_probe(struct auxiliary_device *aux_dev,
 		return -ENOMEM;
 	}
 	iwdev = ib_alloc_device(irdma_device, ibdev);
+	if (!iwdev)
+		return -ENOMEM;
 	/* Fill iwdev info */
 	iwdev->is_vport = true;
 	iwdev->rf = rf;
Re: [PATCH RFC] RDMA/irdma: check vport device allocation
Posted by Leon Romanovsky 2 days, 6 hours ago
On Fri, 11 Sep 2026 14:09:09 +0800, Slavin Liu wrote:
> An existing RDMA function does not guarantee allocation of the new
> vport device. Return -ENOMEM before initializing a NULL iwdev.
> 
> Detected by static analysis and reviewed with AI-assisted source auditing.

Applied, thanks!

[1/1] RDMA/irdma: check vport device allocation
      https://git.kernel.org/rdma/rdma/c/2a770e6a64d66f

Best regards,
-- 
Leon Romanovsky <leon@kernel.org>