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 45DDA45500; Wed, 26 Jun 2024 13:55:40 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6B49442FC9; Wed, 26 Jun 2024 13:55:04 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) by mails.dpdk.org (Postfix) with ESMTP id 5BC3442E95 for ; Wed, 26 Jun 2024 13:43:12 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1719402192; x=1750938192; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=7NbbPTnzBFHU4PBgEj6q/55UGoC6oFdbneGGqu/kgpE=; b=UZEOq5mQFFb3kmNvBEwzIxfmRuUm80et6lEtxTtwDn5BGk+PmJBRUYkH q/Wzlkt+E3T8sbXpuZm5MVlvAOpyJIEdjL3bKh1cC9Rr9JCbJ0a8Yj/2e 8fbQ443DDancyd69Q7giPL+B0rBKLEEUYLYyjvGVWVtjn3BgdgdoPNgbK 43dBXNt9C/OA5VpB2SuGkegFVauMHSNAAHwrfUMhUqbT3aB8kZs5NdW15 ZXx3aIZwUzSSdeIQ69Sch6OzouFLQDj584pn/9TjawkZlgBgtOdbSjHmB b/p0w+3RagAX+DGSSlZa2ncFNVU1vBXBFkD5pJ9RPj3fFH7I1LGhAFGw2 A==; X-CSE-ConnectionGUID: MJ1PMtLmS6m3bRP5quTy/Q== X-CSE-MsgGUID: +y64xT+PS0C+r+CTBhjWuQ== X-IronPort-AV: E=McAfee;i="6700,10204,11114"; a="38979287" X-IronPort-AV: E=Sophos;i="6.08,266,1712646000"; d="scan'208";a="38979287" Received: from orviesa010.jf.intel.com ([10.64.159.150]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Jun 2024 04:43:11 -0700 X-CSE-ConnectionGUID: tTMve1vkR+C5yvl12os7pQ== X-CSE-MsgGUID: spCSopB8RKOhzS0wVb4j+Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,266,1712646000"; d="scan'208";a="43873446" Received: from unknown (HELO silpixa00401119.ir.intel.com) ([10.55.129.167]) by orviesa010.jf.intel.com with ESMTP; 26 Jun 2024 04:43:10 -0700 From: Anatoly Burakov To: dev@dpdk.org Cc: Lukasz Plachno , ian.stokes@intel.com, bruce.richardson@intel.com Subject: [PATCH v4 007/103] net/ice/base: prevent potential integer overflow Date: Wed, 26 Jun 2024 12:40:55 +0100 Message-ID: <74c6a9285ed0cdc8b2868d9406e5e7a034888f6e.1719401847.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