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 6DD7BA04A3 for ; Thu, 24 Feb 2022 05:10:56 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 593FC40E5A; Thu, 24 Feb 2022 05:10:56 +0100 (CET) Received: from mail-pg1-f169.google.com (mail-pg1-f169.google.com [209.85.215.169]) by mails.dpdk.org (Postfix) with ESMTP id 9C59340E5A for ; Thu, 24 Feb 2022 05:10:55 +0100 (CET) Received: by mail-pg1-f169.google.com with SMTP id w37so704390pga.7 for ; Wed, 23 Feb 2022 20:10:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20210112.gappssmtp.com; s=20210112; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Vi9u9Snbt5pjjrtY+rG76BnHC2HEwxeJYDf11yaxfPs=; b=6yTX6jH/Xz7SEfHQHC0J51Vu9xwpk7chxAnpqHz6ApWB5i22uBp4RSGX3Mur5ZaxAq 3G8hHUAkjAWwv5AYBSzvuyLe0ePjfnQSeI/vyTIA2rR1KiyshzAb/lBzERrbFnK8qh6V csJZ0kU1za7J7GqlSNVLEF5D2CsDB3SwFUHm82/wXIZfNu86Dx6/UFI8jTIizqWxskIc ih/JsULjAkbSge472g6/v+UrZxvYMXrfRLVtEmb876jIfW3MyOaMBXFb/RDH5kfJ43f9 H/aijiA1qNbcdxTtmu47sXSkaNd8hAwPyYq2ANc8yoVQEQyUykJnbfhNSvguj8yHjPU8 o1TA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Vi9u9Snbt5pjjrtY+rG76BnHC2HEwxeJYDf11yaxfPs=; b=fdyKSWIOBR3ZUS+mXqYPoeqA8GTYsF0NIgRznenQKj+mx20JIgS+vP4skY7Q1q1+36 9PqgI4UAIJoyRJvqBi3AuK4SOD/LlsC0tCRPWRzcPoaG/DE2XHzZ2QjrzytsPS8jFbZQ 9m9U9fyWfE4It6S1PYsJu9v8Hq3yiIFEIvzVH9ZibfLUHcs0GGrS3bs+b8DFNnKr79f4 tnBw4hY4DGIlfJBxwUHpfg6UT9VfP04euyYKzjyLckphNuysENTHw6Ts3tLx8I+8e6eX i/uqtcBbGedrUjpBdMnJi55hCq9/2zBFwodS8peoNgsPgiqBudVZam9tWbjhXg6/DCnh GRrg== X-Gm-Message-State: AOAM530u39ki8I7VMB4H7JG4WgXPod2e9BYDH0n3+tBf1cdbTmzkIEoH 9DXf6bHlyJKEedsiL5GjZsvMMQ== X-Google-Smtp-Source: ABdhPJwk392vJQeL4qMl6ikvIaKUdR81IpDjpPUO37gioTMuIjdtk1azraV3zYZMWxQranQeewfX1A== X-Received: by 2002:a63:ec46:0:b0:35e:7865:ac76 with SMTP id r6-20020a63ec46000000b0035e7865ac76mr827704pgj.453.1645675854718; Wed, 23 Feb 2022 20:10:54 -0800 (PST) Received: from hermes.local (204-195-112-199.wavecable.com. [204.195.112.199]) by smtp.gmail.com with ESMTPSA id a38sm1135360pfx.161.2022.02.23.20.10.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Feb 2022 20:10:54 -0800 (PST) Date: Wed, 23 Feb 2022 20:10:51 -0800 From: Stephen Hemminger To: Steve Yang Cc: dev@dpdk.org, ferruh.yigit@intel.com, beilei.xing@intel.com, stable@dpdk.org Subject: Re: [PATCH v2] net/i40e: fix unintentional integer overflow Message-ID: <20220223201051.5ed202b6@hermes.local> In-Reply-To: <20220224011722.3585748-1-stevex.yang@intel.com> References: <20220223064147.3512888-1-stevex.yang@intel.com> <20220224011722.3585748-1-stevex.yang@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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 On Thu, 24 Feb 2022 01:17:22 +0000 Steve Yang wrote: > 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)); Could be RTE_BIT64(2 * i + 1) instead?