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 91050454EF; Tue, 25 Jun 2024 13:22:37 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C056E42F5B; Tue, 25 Jun 2024 13:18:05 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.19]) by mails.dpdk.org (Postfix) with ESMTP id 4781D42C24 for ; Tue, 25 Jun 2024 13:16:54 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1719314214; x=1750850214; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=1PRsVEiBx7sMp2MztkoVmTAF2VFeuVGdYz/xxWJC4Wg=; b=GaIq/9tQgVautFmrsx4JrwzGfALji2kK/dHwsnqM7RwQsC+OFdhLrx3K WteatebJ+bgwSl5+A/xc4xbQ5wnDjDZ9k+glvYiX+xpq5cuU0q7h90HiU bRE62HEsBQ9SpyGxd9KcgJIDisELt/I8pQPRobhn3BH1l0ZjIz8v7lA/c fGq6B8LSZYJsQNlnwceoAGX6qb48mZT4DfC1VoAdd0KAxzsIXPWbMJV0+ 6TOjRn3llKVJmGch6ylg3l9slYym5LwVFb04QCDh/0n8r7ipvvFtLBDCA PzcQmVMqccE3xS6yBF2UEqvJaAPn0fYdiYGZvPgDdLhPa6KnYeGKvNy8E Q==; X-CSE-ConnectionGUID: lqdxgJWFT0G5hfDMKBxpvA== X-CSE-MsgGUID: z42f4aL8QCGHNJHXj5vP5w== X-IronPort-AV: E=McAfee;i="6700,10204,11113"; a="16080284" X-IronPort-AV: E=Sophos;i="6.08,263,1712646000"; d="scan'208";a="16080284" 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:16:40 -0700 X-CSE-ConnectionGUID: wQ+Lg9feT9ewXO0lZW1AOg== X-CSE-MsgGUID: uN0DMlv1Q5mtoBuMR33D5w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,263,1712646000"; d="scan'208";a="43719302" Received: from unknown (HELO silpixa00401119.ir.intel.com) ([10.55.129.167]) by orviesa009.jf.intel.com with ESMTP; 25 Jun 2024 04:16:40 -0700 From: Anatoly Burakov To: dev@dpdk.org Cc: Waldemar Dworakowski , bruce.richardson@intel.com, ian.stokes@intel.com Subject: [PATCH v3 062/129] net/ice/base: check array bounds Date: Tue, 25 Jun 2024 12:13:07 +0100 Message-ID: <6a004f1e06cf4d3cef605518fcb1beacb70e9440.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: Waldemar Dworakowski 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 ac592fc3e8..16104dbc71 100644 --- a/drivers/net/ice/base/ice_switch.c +++ b/drivers/net/ice/base/ice_switch.c @@ -7333,12 +7333,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