DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Min Hu (Connor)" <humin29@huawei.com>
To: <dev@dpdk.org>
Cc: <ferruh.yigit@intel.com>, <xiaoyun.li@intel.com>
Subject: [dpdk-dev] [PATCH 1/2] app/testpmd: fix integer overflow during get DCB conf
Date: Thu, 22 Apr 2021 15:03:30 +0800	[thread overview]
Message-ID: <1619075011-11810-2-git-send-email-humin29@huawei.com> (raw)
In-Reply-To: <1619075011-11810-1-git-send-email-humin29@huawei.com>

From: Chengchang Tang <tangchengchang@huawei.com>

In C, constant is treated as integer. Therefore, if nb_queque_pools is
ETH_32_POOLS, the shift here may cause integer overflow.

Fixes: 1a572499beb6 ("app/testpmd: setup DCB forwarding based on traffic class")
Cc: stable@dpdk.org

Signed-off-by: Chengchang Tang <tangchengchang@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
---
 app/test-pmd/testpmd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index afa2a6b..6784160 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -3640,7 +3640,7 @@ get_eth_dcb_conf(portid_t pid, struct rte_eth_conf *eth_conf,
 		for (i = 0; i < vmdq_rx_conf->nb_pool_maps; i++) {
 			vmdq_rx_conf->pool_map[i].vlan_id = vlan_tags[i];
 			vmdq_rx_conf->pool_map[i].pools =
-				1 << (i % vmdq_rx_conf->nb_queue_pools);
+				1ULL << (i % vmdq_rx_conf->nb_queue_pools);
 		}
 		for (i = 0; i < ETH_DCB_NUM_USER_PRIORITIES; i++) {
 			vmdq_rx_conf->dcb_tc[i] = i % num_tcs;
-- 
2.7.4


  reply	other threads:[~2021-04-22  7:03 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-22  7:03 [dpdk-dev] [PATCH 0/2] bugfix for testpmd Min Hu (Connor)
2021-04-22  7:03 ` Min Hu (Connor) [this message]
2021-04-25  2:05   ` [dpdk-dev] [PATCH 1/2] app/testpmd: fix integer overflow during get DCB conf Li, Xiaoyun
2021-04-25  3:21     ` Min Hu (Connor)
2021-04-22  7:03 ` [dpdk-dev] [PATCH 2/2] app/testpmd: fix max queue number when configure Tx offloads Min Hu (Connor)
2021-04-25  2:08   ` Li, Xiaoyun
2021-04-26 14:21     ` 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=1619075011-11810-2-git-send-email-humin29@huawei.com \
    --to=humin29@huawei.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=xiaoyun.li@intel.com \
    /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).