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 14A42454EF; Tue, 25 Jun 2024 13:18:48 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8B98B42E24; Tue, 25 Jun 2024 13:16:10 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.19]) by mails.dpdk.org (Postfix) with ESMTP id AE69042D7D for ; Tue, 25 Jun 2024 13:15:44 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1719314145; x=1750850145; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=7NbbPTnzBFHU4PBgEj6q/55UGoC6oFdbneGGqu/kgpE=; b=YmK91z2xh7ER3hf+ya9eQvRLps/cuWJ8NsziUh2mdwJ44U8Usa3tNXFT cMvYwZ+B3aLboxS+mg37+alphkhY59OI1W+Wdr3dSzbGK1DkTi7TNpJI3 ZC1g5wR6WmvyvRhZ6C+ffiT3vu0JzuthiCUY7DZZW5DRTIeXrZLGLTavC rhcfhASM9wzYGrb3tzLbiIeAjsgGJEmHwkkerzAKgwJOhC5W86jaqArZe dB6VgiyURFDSOVPVObUhV3zefA5pO984UVjUFZ9py6jG65gOJMJN6wed4 wRvRP1WRoA9226dE2BnuxA8D6eM5bk22Iku8wnc/jlEFYnPlD9wM4KSof g==; X-CSE-ConnectionGUID: kWzHfVeESlatEnpoC0V87A== X-CSE-MsgGUID: UwiZHME8RuimCVJsxBRB7A== X-IronPort-AV: E=McAfee;i="6700,10204,11113"; a="16080130" X-IronPort-AV: E=Sophos;i="6.08,263,1712646000"; d="scan'208";a="16080130" Received: from orviesa009.jf.intel.com ([10.64.159.149]) by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Jun 2024 04:15:44 -0700 X-CSE-ConnectionGUID: W+e3Y9H8T0C5AvNDTc2/Eg== X-CSE-MsgGUID: 4e9rh4hsScmcDkeOucaF/g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,263,1712646000"; d="scan'208";a="43719051" Received: from unknown (HELO silpixa00401119.ir.intel.com) ([10.55.129.167]) by orviesa009.jf.intel.com with ESMTP; 25 Jun 2024 04:15:44 -0700 From: Anatoly Burakov To: dev@dpdk.org Cc: Lukasz Plachno , bruce.richardson@intel.com, ian.stokes@intel.com Subject: [PATCH v3 027/129] net/ice/base: prevent potential integer overflow Date: Tue, 25 Jun 2024 12:12:32 +0100 Message-ID: <5d713da4abdab70c13992fa1e07b3f995577b0a9.1719313663.git.anatoly.burakov@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: 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: Lukasz Plachno 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