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 D9C8AA034C; Wed, 23 Feb 2022 07:48:08 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 79D8D40E5A; Wed, 23 Feb 2022 07:48:08 +0100 (CET) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mails.dpdk.org (Postfix) with ESMTP id 201CB40DF6 for ; Wed, 23 Feb 2022 07:48:06 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1645598887; x=1677134887; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=kWWVcLqF/ZMojptHxUOzKbrvn6J5xQvFZCyJDh/1A4I=; b=MtfFu6aJmECn65br82rdDshn0xoFGzSt66EBcjaDn7IMWtAtHGeAsze0 wRgmcvDrL0PLckZZt2uAVwclbaSp9ihI9CRYKGZxWPDXiMzX/NPYyBTtM RabAP8xkgQJEz7pk5G6vHGWHceleCb+S+LY27LbJRr3pX6sgFFEvyt29p wEUHVA9MvAyomvGLLFynNSdw94cVfL4yoltVzqZnq060dzxqBAyEcy/OQ jN8XRPg/bf3X3Zkt3PtrvqwSQONvptToxtfPDLCCm2+1/5BAvKDFPPQJU BfV+0iTLUoti2FzhKJdiizsH+F+RnqzhjwumkQ/PtAFSRXzVMGwpTx5TX Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10266"; a="338334167" X-IronPort-AV: E=Sophos;i="5.88,390,1635231600"; d="scan'208";a="338334167" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Feb 2022 22:48:06 -0800 X-IronPort-AV: E=Sophos;i="5.88,390,1635231600"; d="scan'208";a="706918410" Received: from intel-cd-odc-steve.cd.intel.com ([10.240.178.135]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Feb 2022 22:48:04 -0800 From: Steve Yang To: dev@dpdk.org Cc: beilei.xing@intel.com, Steve Yang Subject: [PATCH v1] net/i40e: fix coverity issue Date: Wed, 23 Feb 2022 06:41:47 +0000 Message-Id: <20220223064147.3512888-1-stevex.yang@intel.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Cast 1 to type uint64_t to avoid overflow. CID 375812 (#1 of 1): Unintentional integer overflow (OVERFLOW_BEFORE_WIDEN) overflow_before_widen: Potentially overflowing expression 1 << 2 * i + 1 with type int (32 bits, signed) is evaluated using 32-bit arithmetic, and then used in a context that expects an expression of type uint64_t (64 bits, unsigned). Coverity issue: 375812 Fixes: 5fec01c35c49 ("net/i40e: support Linux VF to configure IRQ link list") Signed-off-by: Steve Yang --- drivers/net/i40e/i40e_pf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/i40e/i40e_pf.c b/drivers/net/i40e/i40e_pf.c index 2435a8a070..39e0c021a4 100644 --- a/drivers/net/i40e/i40e_pf.c +++ b/drivers/net/i40e/i40e_pf.c @@ -604,7 +604,7 @@ i40e_pf_config_irq_link_list(struct i40e_pf_vf *vf, tempmap = vvm->txq_map; for (i = 0; i < sizeof(vvm->txq_map) * BITS_PER_CHAR; i++) { if (tempmap & 0x1) - linklistmap |= (1 << (2 * i + 1)); + linklistmap |= ((uint64_t)1 << (2 * i + 1)); tempmap >>= 1; } -- 2.27.0