From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by smtp.lore.kernel.org (Postfix) with ESMTP id A3EB1C433EF for ; Tue, 22 Feb 2022 16:03:12 +0000 (UTC) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7129740DF6; Tue, 22 Feb 2022 17:03:11 +0100 (CET) Received: from mail-pg1-f181.google.com (mail-pg1-f181.google.com [209.85.215.181]) by mails.dpdk.org (Postfix) with ESMTP id 3218140DF4 for ; Tue, 22 Feb 2022 17:03:10 +0100 (CET) Received: by mail-pg1-f181.google.com with SMTP id w37so11013423pga.7 for ; Tue, 22 Feb 2022 08:03:10 -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=QY/oGCYVpi7zPrUA9NTPHqkktkxMjMWyKVuPi/0eYu0=; b=ZchqY6wHQRNsqajiQF1rQxCotE4vLa4vKS58+MsafVphMVMxFs8JvOz3ky9HjYBTeO +IYVzmWXBjwUdRCMmhWFtf61KLuZ+WvbvJaXsE2vLgtoiyvNqSMhhOgFf/qNgX2RrXNP lu4Nr5QLkIjh+BgJW9u+JyYM3JT9B4KdBH+2NmJUPs7BVMhyMu8jkX1DjSDu17UkDtgR Np6wR23GikGS5WLrPTz82StIDEhVwpbWi9uJAVImiyBr5LiMGXOJtHNw967Cq1my4VJ7 FJsNvN4loaVNl8yjaMelyJjsottzAFTjPlrmOvykjkNvIlCtlS40K9QGy1+1bPPGTP1X OaSg== 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=QY/oGCYVpi7zPrUA9NTPHqkktkxMjMWyKVuPi/0eYu0=; b=hnQ4oc4pPX9T9m+6+I2rTPAeeiALoSxSSDVypOL7QEwHkN69MN7l0KU55yp5Yq05Sn ysNLYefy919ioTz6sZf5wbwJ7oYOb+3O2LNV3zBvyMfjCI4w2bcnsx5J88ATqd4vuypd Z5d5kQcyJ1shbFXC1ZTm0/qcsbkYKPwerZySk9T2KzTkchpqjDWa3BtYhCshBXDCDkzr 1pLamcxGXpLwLRosrt2wDICwbWF7iJz2ItdxnF21D7M2A4RveePhLCGLIpVchW+7TiQ0 gkquMEUzN4IAqeZeLjQWbCv+BKq1H78c3kryHpaqViSG082uK+j4EEF92cyo/EyYY0TS bsZg== X-Gm-Message-State: AOAM533tmmTeEkzqSb4rGXZGpB+OsyO+p8LIrY5HQDE8+IKf1sFWgVsI kGuxd2qsTJ7LG+srp0dwg4owmmgsnjFOJ+Hn X-Google-Smtp-Source: ABdhPJxhsDsBWISMLII3r/5JvD8FT+O4GeCr8pMTNw9xM5ROZ5KzkN8x64HZwAOflt7PcsmKSPCL9Q== X-Received: by 2002:a05:6a00:a8f:b0:4e1:2619:11a2 with SMTP id b15-20020a056a000a8f00b004e1261911a2mr25373349pfl.53.1645545789168; Tue, 22 Feb 2022 08:03:09 -0800 (PST) Received: from hermes.local (204-195-112-199.wavecable.com. [204.195.112.199]) by smtp.gmail.com with ESMTPSA id 13sm3103791pje.50.2022.02.22.08.03.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Feb 2022 08:03:08 -0800 (PST) Date: Tue, 22 Feb 2022 08:03:06 -0800 From: Stephen Hemminger To: Morten =?UTF-8?B?QnLDuHJ1cA==?= Cc: "Megha Ajmera" , , , Subject: Re: [PATCH] sched: fix integer handling issue Message-ID: <20220222080306.1caf1fc9@hermes.local> In-Reply-To: <98CBD80474FA8B44BF855DF32C47DC35D86EDB@smartserver.smartshare.dk> References: <20220222131851.2944637-1-megha.ajmera@intel.com> <98CBD80474FA8B44BF855DF32C47DC35D86EDB@smartserver.smartshare.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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 Tue, 22 Feb 2022 15:13:53 +0100 Morten Br=C3=B8rup wrote: > > From: Megha Ajmera [mailto:megha.ajmera@intel.com] > > Sent: Tuesday, 22 February 2022 14.19 > >=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 | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > >=20 > > diff --git a/examples/qos_sched/args.c b/examples/qos_sched/args.c > > index 10ca7bea61..44f2f5640e 100644 > > --- a/examples/qos_sched/args.c > > +++ b/examples/qos_sched/args.c > > @@ -433,7 +433,7 @@ app_parse_args(int argc, char **argv) > > return -1; > > } > > } > > - app_used_core_mask |=3D 1u << app_main_core; > > + app_used_core_mask |=3D 1lu << app_main_core; =20 >=20 > Still wrong on 32 bit platforms, where long unsigned int is still 32 bits. >=20 > Use this instead: > app_used_core_mask |=3D RTE_BIT64(app_main_core); DPDK now supports > 64 lcores. So all code using/assuming a 64 bit mask is = broken.