DPDK patches and discussions
 help / color / mirror / Atom feed
From: Jasvinder Singh <jasvinder.singh@intel.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH] net/softnic: fix integer overflow
Date: Thu, 19 Oct 2017 10:39:45 +0100	[thread overview]
Message-ID: <20171019093945.126311-1-jasvinder.singh@intel.com> (raw)

Fixed integer overflow by casting hard_rate to uint64_t type.

CID 195020 (#1 of 1): Unintentional integer overflow
(OVERFLOW_BEFORE_WIDEN)

Fixes: 8316b9816b79 ("net/softnic: support traffic management")

Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
---
 drivers/net/softnic/rte_eth_softnic_tm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/softnic/rte_eth_softnic_tm.c b/drivers/net/softnic/rte_eth_softnic_tm.c
index 682cc4d..dbb2514 100644
--- a/drivers/net/softnic/rte_eth_softnic_tm.c
+++ b/drivers/net/softnic/rte_eth_softnic_tm.c
@@ -47,7 +47,7 @@
 int
 tm_params_check(struct pmd_params *params, uint32_t hard_rate)
 {
-	uint64_t hard_rate_bytes_per_sec = hard_rate * BYTES_IN_MBPS;
+	uint64_t hard_rate_bytes_per_sec = (uint64_t)hard_rate * BYTES_IN_MBPS;
 	uint32_t i;
 
 	/* rate */
-- 
2.9.3

             reply	other threads:[~2017-10-19  9:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-19  9:39 Jasvinder Singh [this message]
2017-10-23 18:54 ` Ferruh Yigit
2017-10-23 19:07   ` Ferruh Yigit

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=20171019093945.126311-1-jasvinder.singh@intel.com \
    --to=jasvinder.singh@intel.com \
    --cc=dev@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;
as well as URLs for NNTP newsgroup(s).