From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796303147; b=CSP7AFU66bWlWXGxrHY7oG1+JmhQ92kaVGFCjh0nBoXbSWAFdGq4b4qxHFGvhBn2YE2F 6ktcjBXzjx/AzbAbp9pifDcd69tzMJk4YfwEqxHBnCMvm2bHnDfmpYiz2bBp5owIgdQHL XF9DXu1B2joMZhhRqzlyB5byMLvOaVJ+pg0OibPexbdp2x+hV+D7KT4UE86DWqwAg24Hg iGzYIlxuGUutA6yl7k3TIwCllw7dicpfRq/12UpnG9WcCP0vc7pwrTNu8kvEw9JTLgVTn y2sn8/dHrdP7hnCWj6Kb7ljxbSZSPCTYE6s185DMuH0L9pZGnW2UljzjkWt8vuUteLw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796303147; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=VpBsk6uXzYzJ/0QTUIfOGg9JjGF/V2PLxpocqfLYdQs=; b=ugSkUmSUd1cqzqTkDq7+9p9QT5E0WkgOvScYbdcc6oZjRKpSaOf/Vjl8mmWG14KI57j0 t9/246Zoqmst/LDvVQ9BGv8s8n0ZyGWohDimHVewK6CNdMNGFJlvj+lA5wyWo3zKcTEm7 Ajd686kMDQwmkePS0khg9gsIA7mTVKo840dZPr1inY1uEN4rCgtv/EUIOKlSf6N6xruRl RtjTCjMBdC/JS7mpYaSTg9Ity9KWFhVgYldi5jKTfgMaxizcpLTInD3PnZP17fTr/qYWo Qq1YiH4Rj9aNBhIIwGcLRkklMwV+5X57KxRI0PYAmnswdnAJ04qCPkUIky2AP/vS4uA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=YfPN76wh; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4C027606A338 for ; Thu, 3 Dec 2026 13:05:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=YfPN76wh Received: by smtp.kernel.org (Postfix) with ESMTPSA id 14B5B1F0089F; Thu, 3 Dec 2026 13:05:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796303147; bh=VpBsk6uXzYzJ/0QTUIfOGg9JjGF/V2PLxpocqfLYdQs=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=YfPN76wh/cFAA8b39CxLI5x3W4bx2hdTU5KFLXQVfdAiOfyWDAsgdRlHdGWttYzQ0 kOHhyb2DvPqLnfhwXzhiWMFA4gCga8vUK8gqEHJ1O7is3EvRF1Mi3AkAUWcifHpvks atAS5ur857OWY1iG73raBVdKJW+n5oiTsJb1/nESMF0PpbfCsEC+uHFKiapyzuWXoq Mq4tXELdihs/itswvcc2ae/8m+UgWBVSOKhrVqAjZbwvlJEfTUMQBs0LFmXuyj8XVe KWNiVI8FNL6RjsZLJvW6cn2RLXSnXeKlE6Id5OlzDNtMR9JPrqYxVAO2vB656WSCOR Lw27/IVBKNSUw== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH net] net/mlx5: Fix divide by zero when a function has no completion EQs Reply-To: sashiko-reviews@lists.linux.dev To: "Tariq Toukan" Cc: linux-rdma@vger.kernel.org In-Reply-To: <20261202130435.3442321-1-tariqt@nvidia.com> References: <20261202130435.3442321-1-tariqt@nvidia.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Thu, 03 Dec 2026 13:05:46 +0000 X-Mailing-List: linux-rdma@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [High] net/mlx5: checking max_comp_eqs in alloc_rmap() aborts probe or misses SFs and !CONFIG_RFS_ACCEL -- commit f8141098642e0cdde28ad4ddb5d332f35642c1ce Author: Yishai Hadas net/mlx5: Fix divide by zero when a function has no completion EQs This commit returns -EINVAL from alloc_rmap() when eq_table->max_comp_eqs is zero to avoid passing zero to alloc_irq_cpu_rmap(). > diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eq.c b/drivers/net/e= thernet/mellanox/mlx5/core/eq.c > index d11ec263d53c9..0795ee24ad7f2 100644 > --- a/drivers/net/ethernet/mellanox/mlx5/core/eq.c > +++ b/drivers/net/ethernet/mellanox/mlx5/core/eq.c > @@ -930,6 +930,9 @@ static int alloc_rmap(struct mlx5_core_dev *mdev) > if (mlx5_core_is_sf(mdev)) > return 0; > =20 > + if (!eq_table->max_comp_eqs) > + return -EINVAL; > + > eq_table->rmap =3D alloc_irq_cpu_rmap(eq_table->max_comp_eqs); > if (!eq_table->rmap) > return -ENOMEM; [Severity: High] Should eq_table->max_comp_eqs =3D=3D 0 fail device probe or only skip aRFS rmap allocation, and why is it checked only here? mlx5_eq_table_create() treats any error from alloc_rmap() as fatal, tearing down the control EQs and aborting mlx5_load(): drivers/net/ethernet/mellanox/mlx5/core/eq.c:mlx5_eq_table_create() { ... err =3D alloc_rmap(dev); if (err) { mlx5_core_err(dev, "Failed to allocate rmap\n"); goto err_rmap; } return 0; err_rmap: destroy_async_eqs(dev); ... } If the function is meant to keep running with only control EQs and without aRFS (where rmap consumers already tolerate a NULL rmap), returning -EINVAL here aborts the entire mlx5_core load when CONFIG_RFS_ACCEL=3Dy. Conversely, if probing with zero completion EQs is not supported and is intended to fail mlx5_eq_table_create(), placing the check inside the CONFIG_RFS_ACCEL version of alloc_rmap() after the mlx5_core_is_sf(mdev) return misses both !CONFIG_RFS_ACCEL builds and SFs (which also wire up mlx5_devlink_port_fn_max_io_eqs_set()). In those cases, mlx5_eq_table_create() succeeds with max_comp_eqs =3D=3D 0, which still triggers a divide-by-zero in callers such as mlx5vf_create_cq() (raw_smp_processor_id() % mlx5_comp_vectors_max(mdev)) or ib_cq_pool_get() when ib_dev.num_comp_vectors is set to 0. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261202130435.3442= 321-1-tariqt@nvidia.com?part=3D1