* [PATCH] net/qede/base: fix division by zero
@ 2026-11-13 14:07 Bulatov Mark
0 siblings, 0 replies; only message in thread
From: Bulatov Mark @ 2026-11-13 14:07 UTC (permalink / raw)
To: Devendra Singh Rawat, Alok Prasad, Sony Chacko, Rasesh Mody,
Harish Patil
Cc: dev, stable, Mark Bulatov, Alexey Simakov
From: Mark Bulatov <ms.bulatov7@gmail.com>
In the ecore_init_wfq_param() function, calculating left_rate_per_vp will
result in a division by zero if num_vports and req_count are configured
to have equal values.
Fix this by adding an extra check.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Fixes: ec94dbc573 ("qede: add base driver")
Cc: stable@dpdk.org
Signed-off-by: Alexey Simakov <bigalex934@gmail.com>
Signed-off-by: Mark Bulatov <ms.bulatov7@gmail.com>
---
drivers/net/qede/base/ecore_dev.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/net/qede/base/ecore_dev.c b/drivers/net/qede/base/ecore_dev.c
index e895dee405..2082971b0b 100644
--- a/drivers/net/qede/base/ecore_dev.c
+++ b/drivers/net/qede/base/ecore_dev.c
@@ -6481,6 +6481,13 @@ static enum _ecore_status_t ecore_init_wfq_param(struct ecore_hwfn *p_hwfn,
return ECORE_INVAL;
}
+ /* Validate non_requested_count is non-zero */
+ if (non_requested_count == 0) {
+ DP_VERBOSE(p_hwfn, ECORE_MSG_LINK,
+ "The number of vports is equal to the number of requests\n");
+ return ECORE_INVAL;
+ }
+
/* Data left for non requested vports */
total_left_rate = min_pf_rate - total_req_min_rate;
left_rate_per_vp = total_left_rate / non_requested_count;
--
2.39.5
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-11-13 16:06 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-13 14:07 [PATCH] net/qede/base: fix division by zero Bulatov Mark
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox