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 68E5DA00C2; Wed, 23 Feb 2022 19:13:16 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3816F40E5A; Wed, 23 Feb 2022 19:13:15 +0100 (CET) Received: from smartserver.smartsharesystems.com (smartserver.smartsharesystems.com [77.243.40.215]) by mails.dpdk.org (Postfix) with ESMTP id 50D254114B for ; Wed, 23 Feb 2022 19:13:13 +0100 (CET) X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Subject: RE: [PATCH v2] sched: fix integer handling issue Date: Wed, 23 Feb 2022 19:13:12 +0100 Message-ID: <98CBD80474FA8B44BF855DF32C47DC35D86EE7@smartserver.smartshare.dk> In-Reply-To: <20220223173630.2951400-1-megha.ajmera@intel.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PATCH v2] sched: fix integer handling issue Thread-Index: Adgo2+xSMEqkamZySe68HsOvWVTIzAABKBJw References: <20220222131851.2944637-1-megha.ajmera@intel.com> <20220223173630.2951400-1-megha.ajmera@intel.com> From: =?iso-8859-1?Q?Morten_Br=F8rup?= To: "Megha Ajmera" , , , , , 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 > From: Megha Ajmera [mailto:megha.ajmera@intel.com] > Sent: Wednesday, 23 February 2022 18.37 >=20 > Masking of core mask was incorrect. Instead of using 1U for shifting, > it > should be using 1LU as the result is assigned to uint64. >=20 > CID 375859: Potentially overflowing expression "1U << app_main_core" > with > type "unsigned int" (32 bits, unsigned) is evaluated using 32-bit > arithmetic, and then used in a context that expects an expression of > type "uint64_t" (64 bits, unsigned). >=20 > Coverity issue: 375859 >=20 > Signed-off-by: Megha Ajmera > --- > examples/qos_sched/args.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) >=20 > diff --git a/examples/qos_sched/args.c b/examples/qos_sched/args.c > index 10ca7bea61..562d9ca150 100644 > --- a/examples/qos_sched/args.c > +++ b/examples/qos_sched/args.c > @@ -427,13 +427,13 @@ app_parse_args(int argc, char **argv) >=20 > /* check main core index validity */ > for (i =3D 0; i <=3D app_main_core; i++) { > - if (app_used_core_mask & (1u << app_main_core)) { > + if (app_used_core_mask & (RTE_BIT64(app_main_core))) { No need for parenthesis around RTE_BIT64(app_main_core). > RTE_LOG(ERR, APP, "Main core index is not configured > properly\n"); > app_usage(prgname); > return -1; > } > } > - app_used_core_mask |=3D 1u << app_main_core; > + app_used_core_mask |=3D RTE_BIT64(app_main_core); >=20 > if ((app_used_core_mask !=3D app_eal_core_mask()) || > (app_main_core !=3D rte_get_main_lcore())) { > -- > 2.25.1 >=20 Acked-by: Morten Br=F8rup