From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 9289F1B4C1; Wed, 24 Apr 2019 04:30:15 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Apr 2019 19:30:14 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,388,1549958400"; d="scan'208";a="133851090" Received: from npg_dpdk_virtio_tbie_2.sh.intel.com ([10.67.104.173]) by orsmga007.jf.intel.com with ESMTP; 23 Apr 2019 19:30:12 -0700 From: Tiwei Bie To: wenzhuo.lu@intel.com, jingjing.wu@intel.com, bernard.iremonger@intel.com, dev@dpdk.org Cc: stable@dpdk.org Date: Wed, 24 Apr 2019 10:29:31 +0800 Message-Id: <20190424022931.32281-1-tiwei.bie@intel.com> X-Mailer: git-send-email 2.17.1 Subject: [dpdk-dev] [PATCH] app/testpmd: fix unintentional integer overflow X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Apr 2019 02:30:16 -0000 Fix the potential overflow in expression 1 << begin by using 1ULL. Coverity issue: 279437, 279445 Fixes: c73a9071877a ("app/testpmd: add commands to test new offload API") Cc: stable@dpdk.org Signed-off-by: Tiwei Bie --- app/test-pmd/cmdline.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 5a10c5f38..03926f913 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -17739,7 +17739,7 @@ print_rx_offloads(uint64_t offloads) begin = __builtin_ctzll(offloads); end = sizeof(offloads) * CHAR_BIT - __builtin_clzll(offloads); - single_offload = 1 << begin; + single_offload = 1ULL << begin; for (bit = begin; bit < end; bit++) { if (offloads & single_offload) printf(" %s", @@ -18133,7 +18133,7 @@ print_tx_offloads(uint64_t offloads) begin = __builtin_ctzll(offloads); end = sizeof(offloads) * CHAR_BIT - __builtin_clzll(offloads); - single_offload = 1 << begin; + single_offload = 1ULL << begin; for (bit = begin; bit < end; bit++) { if (offloads & single_offload) printf(" %s", -- 2.17.1 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 92F32A05D3 for ; Wed, 24 Apr 2019 04:30:18 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 219DD1B4D5; Wed, 24 Apr 2019 04:30:17 +0200 (CEST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 9289F1B4C1; Wed, 24 Apr 2019 04:30:15 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Apr 2019 19:30:14 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,388,1549958400"; d="scan'208";a="133851090" Received: from npg_dpdk_virtio_tbie_2.sh.intel.com ([10.67.104.173]) by orsmga007.jf.intel.com with ESMTP; 23 Apr 2019 19:30:12 -0700 From: Tiwei Bie To: wenzhuo.lu@intel.com, jingjing.wu@intel.com, bernard.iremonger@intel.com, dev@dpdk.org Cc: stable@dpdk.org Date: Wed, 24 Apr 2019 10:29:31 +0800 Message-Id: <20190424022931.32281-1-tiwei.bie@intel.com> X-Mailer: git-send-email 2.17.1 Subject: [dpdk-dev] [PATCH] app/testpmd: fix unintentional integer overflow X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" Content-Type: text/plain; charset="UTF-8" Message-ID: <20190424022931.uZK3zG67CUQz9y6yYe0mCI2pQOcc1uHS4D7V5m8Jfiw@z> Fix the potential overflow in expression 1 << begin by using 1ULL. Coverity issue: 279437, 279445 Fixes: c73a9071877a ("app/testpmd: add commands to test new offload API") Cc: stable@dpdk.org Signed-off-by: Tiwei Bie --- app/test-pmd/cmdline.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 5a10c5f38..03926f913 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -17739,7 +17739,7 @@ print_rx_offloads(uint64_t offloads) begin = __builtin_ctzll(offloads); end = sizeof(offloads) * CHAR_BIT - __builtin_clzll(offloads); - single_offload = 1 << begin; + single_offload = 1ULL << begin; for (bit = begin; bit < end; bit++) { if (offloads & single_offload) printf(" %s", @@ -18133,7 +18133,7 @@ print_tx_offloads(uint64_t offloads) begin = __builtin_ctzll(offloads); end = sizeof(offloads) * CHAR_BIT - __builtin_clzll(offloads); - single_offload = 1 << begin; + single_offload = 1ULL << begin; for (bit = begin; bit < end; bit++) { if (offloads & single_offload) printf(" %s", -- 2.17.1