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 461AB4404F; Wed, 12 Jun 2024 17:10:30 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 34BD1427BC; Wed, 12 Jun 2024 17:04:09 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.10]) by mails.dpdk.org (Postfix) with ESMTP id 1B736427B7 for ; Wed, 12 Jun 2024 17:04:07 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1718204648; x=1749740648; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Jex/+dolVgQedcJ7kR47gBJhtiE2QoJldabPwsXk4jo=; b=Auq7LXTX8k6Fmy+5KuVuvcyghLwkhC08bb9GKGgmEp/Ljfez7S6RO21X 9XOtLAa7AoAzD6zZ0lpTwf/Cmd5xcABS0FHVPbQbogFrM2gT98kSNQugP qOeMfHFCjdJyu0QE0HzUL5UICAu0LG4hHrrzXIT7wKpTbAlS06g66siPJ tycJSOd4UqAaIDiXoNY1dLt7U+Hd5uQq5k7A2qJwSjgAgiknhd2uTRbnB PVdzlutCgAyXXIdxs+oEsC8FITx+yAx1a212ARb2vX+PBQVuNoOjJipMX 4jpaqsFDOvjCUWw3nL7W0M2CjJWTKyVpfrj2iL6hm+i6zKdT5AJdfuCXT Q==; X-CSE-ConnectionGUID: PfrWDXpGSQSau49i4/7R4Q== X-CSE-MsgGUID: xuaWvoleRFKij9MuOKmwHg== X-IronPort-AV: E=McAfee;i="6700,10204,11101"; a="32459323" X-IronPort-AV: E=Sophos;i="6.08,233,1712646000"; d="scan'208";a="32459323" Received: from orviesa009.jf.intel.com ([10.64.159.149]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jun 2024 08:04:08 -0700 X-CSE-ConnectionGUID: qZydvOpoRFG0GmgnO1goNA== X-CSE-MsgGUID: KMnmBHIjT8GhdNQHTVCAbQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,233,1712646000"; d="scan'208";a="39925057" Received: from silpixa00401119.ir.intel.com ([10.55.129.167]) by orviesa009.jf.intel.com with ESMTP; 12 Jun 2024 08:04:07 -0700 From: Anatoly Burakov To: dev@dpdk.org Cc: Ian Stokes , bruce.richardson@intel.com, Lukasz Plachno Subject: [PATCH v2 031/148] net/ice/base: prevent potential integer overflow Date: Wed, 12 Jun 2024 16:00:25 +0100 Message-ID: <58c45080d5fc262d85cf050239acb7a3be492e75.1718204528.git.anatoly.burakov@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: <20240430154014.1026-1-ian.stokes@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 From: Ian Stokes The original bit-shift was made on a 16-bit value which could overflow. Use 64-bit integer to do bit-shifts instead. Signed-off-by: Lukasz Plachno Signed-off-by: Ian Stokes --- drivers/net/ice/base/ice_parser_rt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ice/base/ice_parser_rt.c b/drivers/net/ice/base/ice_parser_rt.c index 69655fdd96..50a3d301b0 100644 --- a/drivers/net/ice/base/ice_parser_rt.c +++ b/drivers/net/ice/base/ice_parser_rt.c @@ -469,9 +469,9 @@ static void _err_add(struct ice_parser_rt *rt, int idx, bool val) { rt->pu.err_msk |= (u16)(1 << idx); if (val) - rt->pu.flg_val |= (u16)(1 << idx); + rt->pu.flg_val |= (1ULL << idx); else - rt->pu.flg_val &= ~(u16)(1 << idx); + rt->pu.flg_val &= ~(1ULL << idx); ice_debug(rt->psr->hw, ICE_DBG_PARSER, "Pending update for error %d value %d\n", idx, val); -- 2.43.0