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 CD315A00C2; Wed, 23 Feb 2022 18:41:17 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B7ABA40E64; Wed, 23 Feb 2022 18:41:17 +0100 (CET) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mails.dpdk.org (Postfix) with ESMTP id 1810340DF6 for ; Wed, 23 Feb 2022 18:41:15 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1645638076; x=1677174076; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=HuNdyHh85cMyQHrl6Uwn1xTIBmsNRzuNeqUl+S1EyGE=; b=keJAUEuor/hXyF6Jy0pDRd4KY8GWt9OleRXyk3Kxv0KXv6iXDCNdRx/F 1PEicUWUeMVKrBqPTurjiJriQAOeR6Dx2xWNN9GpJSE5bTXzTrLq/Bgw6 tu2zu6M8SDKteott8Hdc6KVPL15cvLnrquKt7FTw5ygo5xY6bBvoOUfa0 Z66pH1Ilgik/nJ7Z8Qw1ZTl/K2fuNVmA31m5PsD5OGZO7n+tEfj4e/WLh 3R3R6ma6ZySD6I4Nnai6BvmkzBf0ZiNppVwMj2/6aK31x8Wh3REYQMMkL 2i/W8VxCmljMd1RyS7OGAwrXOLdatWYre6ywMakbcK4HufeGzfE4byCc3 g==; X-IronPort-AV: E=McAfee;i="6200,9189,10267"; a="338473187" X-IronPort-AV: E=Sophos;i="5.88,391,1635231600"; d="scan'208";a="338473187" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Feb 2022 09:36:35 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,391,1635231600"; d="scan'208";a="683985045" Received: from silpixa00397515.ir.intel.com (HELO silpixa00397515.ger.corp.intel.com) ([10.237.222.51]) by fmsmga001.fm.intel.com with ESMTP; 23 Feb 2022 09:36:33 -0800 From: Megha Ajmera To: dev@dpdk.org, mb@smartsharesystems.com, stephen@networkplumber.org, thomas@monjalon.net, john.mcnamara@intel.com, sham.singh.thakur@intel.com Subject: [PATCH v2] sched: fix integer handling issue Date: Wed, 23 Feb 2022 17:36:30 +0000 Message-Id: <20220223173630.2951400-1-megha.ajmera@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220222131851.2944637-1-megha.ajmera@intel.com> References: <20220222131851.2944637-1-megha.ajmera@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Masking of core mask was incorrect. Instead of using 1U for shifting, it should be using 1LU as the result is assigned to uint64. 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). Coverity issue: 375859 Signed-off-by: Megha Ajmera --- examples/qos_sched/args.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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) /* check main core index validity */ for (i = 0; i <= app_main_core; i++) { - if (app_used_core_mask & (1u << app_main_core)) { + if (app_used_core_mask & (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 |= 1u << app_main_core; + app_used_core_mask |= RTE_BIT64(app_main_core); if ((app_used_core_mask != app_eal_core_mask()) || (app_main_core != rte_get_main_lcore())) { -- 2.25.1