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 08D8EA04A2; Thu, 24 Feb 2022 05:10:57 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 758E74115D; 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 9D63B4114D for ; Thu, 24 Feb 2022 05:10:55 +0100 (CET) Received: by mail-pg1-f169.google.com with SMTP id 12so749304pgd.0 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=MSWwmhsXj68aRagbK2+rQ2Cqz0vFGFDvMQvrOBg4EXiGesghNvoaojUWNY4pfiNJ7N fNSQJaYEUPrn3kKUSSjdVwxIO+q3jmT7J8ZWIhT7ygJ2ESMTK1g5eQbgwOxunecHAVdw +7ErLkK2TEkg7+lFBtkoDLDsN5XzE6ENYz3iovBpAuPwLD3WBr5RzzUHkF8tAG6QM8nD bYb2DuG4JHnpRoW3KWCqcbj2b8zic5nzSXOz+88S/0FWPMN5qNj7MEsAKKZeXPMQ8MwJ D0pnTC7R5MCnywkR6N1SdoLZ+Mr0pn8+rcyeBmxaBbqW6bkuGbYEDeoomUqmRMXL11Bg CYIA== X-Gm-Message-State: AOAM530K5IrbpVw51BeeSD+2hCKqfKtLOZHEDrfnxgD/8d2swhJAVFdq /9YOUtcPipfEYCKUYIzn43Ixpg== 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: 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 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?