From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id AD644A09E4; Thu, 22 Apr 2021 09:03:29 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 13F1D41C84; Thu, 22 Apr 2021 09:03:28 +0200 (CEST) Received: from szxga04-in.huawei.com (szxga04-in.huawei.com [45.249.212.190]) by mails.dpdk.org (Postfix) with ESMTP id D713441C83 for ; Thu, 22 Apr 2021 09:03:26 +0200 (CEST) Received: from DGGEMS403-HUB.china.huawei.com (unknown [172.30.72.59]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4FQpGH2b10zmdt2 for ; Thu, 22 Apr 2021 15:00:23 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by DGGEMS403-HUB.china.huawei.com (10.3.19.203) with Microsoft SMTP Server id 14.3.498.0; Thu, 22 Apr 2021 15:03:19 +0800 From: "Min Hu (Connor)" To: CC: , Date: Thu, 22 Apr 2021 15:03:30 +0800 Message-ID: <1619075011-11810-2-git-send-email-humin29@huawei.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1619075011-11810-1-git-send-email-humin29@huawei.com> References: <1619075011-11810-1-git-send-email-humin29@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.69.192.56] X-CFilter-Loop: Reflected Subject: [dpdk-dev] [PATCH 1/2] app/testpmd: fix integer overflow during get DCB conf X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Chengchang Tang 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 Signed-off-by: Min Hu (Connor) --- 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