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 9BCCBA04A2 for ; Thu, 24 Feb 2022 02:23:46 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 960C741148; Thu, 24 Feb 2022 02:23:46 +0100 (CET) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by mails.dpdk.org (Postfix) with ESMTP id F3B0740151; Thu, 24 Feb 2022 02:23:43 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1645665824; x=1677201824; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=5ynUWQc3eQXTwM1haAe25NAzrDMc9xfOj/UvDXE/Ka4=; b=LSbqxDGuE3Wr/LoVIm8XbLLI9ylZpw5JPCt2f1ANxD9+wBU1Oi+jLI5h eHcTnfNf0zQNIaY1d+RJHhDpqmbcN+jajmiuhMVTY1TuC0Nu1hoohmOJ0 caWyQtkbUloGwS+aEmRRcXya+LqwX37/SCfexW7lYySL8ropd0bIDJ3dy aOmWMZnpb7gst6UyQyGHvokQ6efC7GuWa1k0MmL8ivT6GstOdyLTW8p2x 2Qrc8lDiOCr6ESmwdH4q9KJrFHaHb560/iKeP0I6csemi5+ujqTx5fwKy e+RgQIKCosB+XnZpZPMnfUEcPTHn6VytQOnjaGiqPM8CQ7qC7Pnv9rs9P Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10267"; a="315348853" X-IronPort-AV: E=Sophos;i="5.88,392,1635231600"; d="scan'208";a="315348853" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Feb 2022 17:23:42 -0800 X-IronPort-AV: E=Sophos;i="5.88,392,1635231600"; d="scan'208";a="548520545" Received: from intel-cd-odc-steve.cd.intel.com ([10.240.178.135]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Feb 2022 17:23:40 -0800 From: Steve Yang To: dev@dpdk.org Cc: ferruh.yigit@intel.com, beilei.xing@intel.com, Steve Yang , stable@dpdk.org Subject: [PATCH v2] net/i40e: fix unintentional integer overflow Date: Thu, 24 Feb 2022 01:17:22 +0000 Message-Id: <20220224011722.3585748-1-stevex.yang@intel.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220223064147.3512888-1-stevex.yang@intel.com> References: <20220223064147.3512888-1-stevex.yang@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-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") Cc: stable@dpdk.org --- v2: update commit message. 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