DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Bulatov Mark <ms.bulatov7@gmail.com>
To: Devendra Singh Rawat <dsinghrawat@marvell.com>,
	Alok Prasad <palok@marvell.com>,
	Sony Chacko <sony.chacko@qlogic.com>,
	Rasesh Mody <rmody@marvell.com>,
	Harish Patil <harish.patil@cavium.com>
Cc: dev@dpdk.org, stable@dpdk.org,
	Mark Bulatov <ms.bulatov7@gmail.com>,
	Alexey Simakov <bigalex934@gmail.com>
Subject: [PATCH] net/qede/base: fix division by zero
Date: Fri, 13 Nov 2026 17:07:02 +0300	[thread overview]
Message-ID: <20261113140702.4485-1-ms.bulatov7@gmail.com> (raw)

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


                 reply	other threads:[~2026-11-13 16:06 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20261113140702.4485-1-ms.bulatov7@gmail.com \
    --to=ms.bulatov7@gmail.com \
    --cc=bigalex934@gmail.com \
    --cc=dev@dpdk.org \
    --cc=dsinghrawat@marvell.com \
    --cc=harish.patil@cavium.com \
    --cc=palok@marvell.com \
    --cc=rmody@marvell.com \
    --cc=sony.chacko@qlogic.com \
    --cc=stable@dpdk.org \
    /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