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 7BAE24404F; Wed, 12 Jun 2024 17:17:00 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0741E42ECE; Wed, 12 Jun 2024 17:05:39 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.10]) by mails.dpdk.org (Postfix) with ESMTP id B9C1842EAA for ; Wed, 12 Jun 2024 17:05:29 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1718204730; x=1749740730; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ozJIiiwGhTbiw9A1V58CmGGOgexkoanDVG/j+8qO0Rs=; b=VlocQLi3cbngbVFmJNNYqar70q4X3VQ9Kw2iL5HQZkrG54GJV6vROUnP 7F9o8Z6o6t8tz6j+t9Pq06P94lH/m1prbgR5rbS4S6d2PAm/9H9oWJ87a APxgnbz1r1GqzdOL0KHH53ihDg0vm1ZSI6GrrWRbZG+gMx+r2KJXp/9d5 r//vj97/UY9Z5ZqLpsfvi7E2Lat0Aypa8nvrGag0ViHCuQ86vAgPdnaFz f5kXRXzJxQ2w3PzRDJaJwm2In9aypSazIj899RWQW6esD/+ki6xIgXjWq uAqzcZgEQasOeGuv6TcsevHrF4cL7dlgtJGgfdpkpohEAJPpqalNjWLXE w==; X-CSE-ConnectionGUID: PJaqH0UsQoSPsSgykhFA4g== X-CSE-MsgGUID: /6k29vncSuCqqfdpA6qMyA== X-IronPort-AV: E=McAfee;i="6700,10204,11101"; a="32459684" X-IronPort-AV: E=Sophos;i="6.08,233,1712646000"; d="scan'208";a="32459684" 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:05:29 -0700 X-CSE-ConnectionGUID: bZfcQlUCRtKZ5nurs13uxQ== X-CSE-MsgGUID: jA5qvWdwSEe5NuTOU7k3eA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,233,1712646000"; d="scan'208";a="39925566" Received: from silpixa00401119.ir.intel.com ([10.55.129.167]) by orviesa009.jf.intel.com with ESMTP; 12 Jun 2024 08:05:28 -0700 From: Anatoly Burakov To: dev@dpdk.org Cc: Ian Stokes , bruce.richardson@intel.com, Waldemar Dworakowski Subject: [PATCH v2 080/148] net/ice/base: check array bounds Date: Wed, 12 Jun 2024 16:01:14 +0100 Message-ID: <46403e6aaa6a5a231ba72db977d301cac18fc493.1718204529.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 Some compilation targets were generating errors due to unchecked array bounds when accessing recipe groups. Add a check to avoid that. Signed-off-by: Waldemar Dworakowski Signed-off-by: Ian Stokes --- drivers/net/ice/base/ice_switch.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/net/ice/base/ice_switch.c b/drivers/net/ice/base/ice_switch.c index 9ea302585c..051cf087f5 100644 --- a/drivers/net/ice/base/ice_switch.c +++ b/drivers/net/ice/base/ice_switch.c @@ -7533,12 +7533,14 @@ ice_create_first_fit_recp_def(struct ice_hw *hw, (*recp_cnt)++; } - grp->pairs[grp->n_val_pairs].prot_id = - lkup_exts->fv_words[j].prot_id; - grp->pairs[grp->n_val_pairs].off = - lkup_exts->fv_words[j].off; - grp->mask[grp->n_val_pairs] = lkup_exts->field_mask[j]; - grp->n_val_pairs++; + if (grp->n_val_pairs < ICE_NUM_WORDS_RECIPE) { + grp->pairs[grp->n_val_pairs].prot_id = + lkup_exts->fv_words[j].prot_id; + grp->pairs[grp->n_val_pairs].off = + lkup_exts->fv_words[j].off; + grp->mask[grp->n_val_pairs] = lkup_exts->field_mask[j]; + grp->n_val_pairs++; + } } return 0; -- 2.43.0