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 5795CA00BE; Thu, 17 Feb 2022 16:02:58 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 90F6F40395; Thu, 17 Feb 2022 16:02:57 +0100 (CET) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mails.dpdk.org (Postfix) with ESMTP id E9D8840150; Thu, 17 Feb 2022 16:02:55 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1645110176; x=1676646176; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=y4WaYLGC28l2ny2ye34cbCnQX4eETqnSVZacvkpdiAo=; b=MBjd25qii1xIn+qjPeu19HhLnyxV8tsi83VmhSYMk2YcVsgMQeNVydpK 5xOfOJliRBbqJeFVpxiNNwgSwy+pDGWcESIJVAlAHARsq8Y0si+hdefsI B9wfsZtS579ZfTKL/FmePY7cdAyBoTgvA8yaijWsK681Ysr1uFuSyj86V 59gZhYvm5bO4kryDWvo9vvjQpEZVs6Ykl4Jsy+bJuuIRppZrYu4JUl9Ln xVjGKTZbyk8/Ffo50gl9CnXLZmsKHkK9XC/fYVkWoasitHkMRCXU/pnsV 2YlNohvN6Lo4JowJdI84AK2DEzTBYn9p7YRIE+/gXKJVlcB/H3wkAbFtW A==; X-IronPort-AV: E=McAfee;i="6200,9189,10260"; a="230853740" X-IronPort-AV: E=Sophos;i="5.88,376,1635231600"; d="scan'208";a="230853740" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Feb 2022 07:02:55 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,376,1635231600"; d="scan'208";a="704838187" Received: from silpixa00399126.ir.intel.com ([10.237.223.34]) by orsmga005.jf.intel.com with ESMTP; 17 Feb 2022 07:02:53 -0800 From: Bruce Richardson To: dev@dpdk.org Cc: David Hunt , Bruce Richardson , stable@dpdk.org Subject: [PATCH] distributor: fix potential overflow bug Date: Thu, 17 Feb 2022 15:02:39 +0000 Message-Id: <20220217150239.69876-1-bruce.richardson@intel.com> X-Mailer: git-send-email 2.32.0 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 Coverity flags the fact that the tag values used in distributor are 32-bit, which means that when we use bit-manipulation to convert a tag match/no-match to a bit in an array, we need to typecast to a 64-bit type before shifting past 32 bits. Coverity issue: 375808 Fixes: 08ccf3faa6a9 ("distributor: new packet distributor library") Cc: stable@dpdk.org Signed-off-by: Bruce Richardson --- lib/distributor/rte_distributor_single.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/distributor/rte_distributor_single.c b/lib/distributor/rte_distributor_single.c index b653620688..60ca86152f 100644 --- a/lib/distributor/rte_distributor_single.c +++ b/lib/distributor/rte_distributor_single.c @@ -247,8 +247,7 @@ rte_distributor_process_single(struct rte_distributor_single *d, * worker given by the bit-position */ for (i = 0; i < d->num_workers; i++) - match |= (!(d->in_flight_tags[i] ^ new_tag) - << i); + match |= ((uint64_t)!(d->in_flight_tags[i] ^ new_tag) << i); /* Only turned-on bits are considered as match */ match &= d->in_flight_bitmask; -- 2.32.0