netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: Junfeng Guo <junfeng.guo@intel.com>
Cc: intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org,
	anthony.l.nguyen@intel.com, jesse.brandeburg@intel.com,
	qi.z.zhang@intel.com, ivecera@redhat.com,
	sridhar.samudrala@intel.com, kuba@kernel.org,
	edumazet@google.com, davem@davemloft.net, pabeni@redhat.com
Subject: Re: [PATCH iwl-next v8 12/15] ice: add parser execution main loop
Date: Thu, 24 Aug 2023 17:39:01 +0200	[thread overview]
Message-ID: <20230824153901.GJ3523530@kernel.org> (raw)
In-Reply-To: <20230824075500.1735790-13-junfeng.guo@intel.com>

On Thu, Aug 24, 2023 at 03:54:57PM +0800, Junfeng Guo wrote:
> Implement function ice_parser_rt_execute which perform the main
> loop of the parser.
> 
> Also include the Parser Library files into ice Makefile.
> 
> Signed-off-by: Junfeng Guo <junfeng.guo@intel.com>

...

> @@ -80,6 +107,632 @@ void ice_parser_rt_pktbuf_set(struct ice_parser_rt *rt, const u8 *pkt_buf,
>  	memcpy(&rt->gpr[ICE_GPR_HV_IDX], &rt->pkt_buf[ho], ICE_GPR_HV_SIZE);
>  }
>  
> +static void _ice_bst_key_init(struct ice_parser_rt *rt,
> +			      struct ice_imem_item *imem)
> +{
> +	u8 tsr = (u8)rt->gpr[ICE_GPR_TSR_IDX];
> +	u16 ho = rt->gpr[ICE_GPR_HO_IDX];
> +	u8 *key = rt->bst_key;
> +	int idd, i;
> +
> +	idd = ICE_BST_TCAM_KEY_SIZE - 1;
> +	if (imem->b_kb.tsr_ctrl)
> +		key[idd] = (u8)tsr;
> +	else
> +		key[idd] = imem->b_kb.prio;
> +
> +	idd = ICE_BST_KEY_TCAM_SIZE - 1;
> +	for (i = idd; i >= 0; i--) {
> +		int j;
> +
> +		j = ho + idd - i;
> +		if (j < ICE_PARSER_MAX_PKT_LEN)
> +			key[i] = rt->pkt_buf[ho + idd - i];
> +		else
> +			key[i] = 0;
> +	}
> +
> +	ice_debug(rt->psr->hw, ICE_DBG_PARSER, "Generated Boost TCAM Key:\n");
> +	ice_debug(rt->psr->hw, ICE_DBG_PARSER, "%02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X\n",
> +		  key[0], key[1], key[2], key[3], key[4],
> +		  key[5], key[6], key[7], key[8], key[9],
> +		  key[10], key[11], key[12], key[13], key[14],
> +		  key[15], key[16], key[17], key[18], key[19]);

Hi Junfeng Guo,

key points to rt->bst_key which has ICE_BST_KEY_SIZE (10) elements.
But here 20 elements are accessed. This seems to be an overrun.

Flagged by Smatch.

> +	ice_debug(rt->psr->hw, ICE_DBG_PARSER, "\n");
> +}
> +

  reply	other threads:[~2023-08-24 15:39 UTC|newest]

Thread overview: 76+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20230605054641.2865142-1-junfeng.guo@intel.com>
2023-08-21  2:38 ` [PATCH iwl-next v5 00/15] Introduce the Parser Library Junfeng Guo
2023-08-21  2:38   ` [PATCH iwl-next v5 01/15] ice: add parser create and destroy skeleton Junfeng Guo
2023-08-21  7:20     ` Simon Horman
2023-08-21  7:30       ` Simon Horman
2023-08-21  7:34         ` Guo, Junfeng
2023-08-21 14:47           ` Simon Horman
2023-08-22  2:47             ` Guo, Junfeng
2023-08-21  2:38   ` [PATCH iwl-next v5 02/15] ice: init imem table for parser Junfeng Guo
2023-08-21  2:38   ` [PATCH iwl-next v5 03/15] ice: init metainit " Junfeng Guo
2023-08-21  2:38   ` [PATCH iwl-next v5 04/15] ice: init parse graph cam tables " Junfeng Guo
2023-08-21  2:38   ` [PATCH iwl-next v5 05/15] ice: init boost tcam and label " Junfeng Guo
2023-08-21  2:38   ` [PATCH iwl-next v5 06/15] ice: init ptype marker tcam table " Junfeng Guo
2023-08-21  2:38   ` [PATCH iwl-next v5 07/15] ice: init marker and protocol group tables " Junfeng Guo
2023-08-21  2:38   ` [PATCH iwl-next v5 08/15] ice: init flag redirect table " Junfeng Guo
2023-08-21  2:38   ` [PATCH iwl-next v5 09/15] ice: init XLT key builder " Junfeng Guo
2023-08-21  2:38   ` [PATCH iwl-next v5 10/15] ice: add parser runtime skeleton Junfeng Guo
2023-08-21  2:38   ` [PATCH iwl-next v5 11/15] ice: add internal help functions Junfeng Guo
2023-08-21  2:38   ` [PATCH iwl-next v5 12/15] ice: add parser execution main loop Junfeng Guo
2023-08-21  2:38   ` [PATCH iwl-next v5 13/15] ice: support double vlan mode configure for parser Junfeng Guo
2023-08-21  2:38   ` [PATCH iwl-next v5 14/15] ice: add tunnel port support " Junfeng Guo
2023-08-21  2:38   ` [PATCH iwl-next v5 15/15] ice: add API for parser profile initialization Junfeng Guo
2023-08-21  6:46   ` [EXT] [PATCH iwl-next v5 00/15] Introduce the Parser Library Subbaraya Sundeep Bhatta
2023-08-21  7:15     ` Guo, Junfeng
2023-08-21  8:14   ` [PATCH iwl-next v6 " Junfeng Guo
2023-08-21  8:14     ` [PATCH iwl-next v6 01/15] ice: add parser create and destroy skeleton Junfeng Guo
2023-08-21  8:14     ` [PATCH iwl-next v6 02/15] ice: init imem table for parser Junfeng Guo
2023-08-21  8:14     ` [PATCH iwl-next v6 03/15] ice: init metainit " Junfeng Guo
2023-08-21  8:14     ` [PATCH iwl-next v6 04/15] ice: init parse graph cam tables " Junfeng Guo
2023-08-21  8:14     ` [PATCH iwl-next v6 05/15] ice: init boost tcam and label " Junfeng Guo
2023-08-21  8:14     ` [PATCH iwl-next v6 06/15] ice: init ptype marker tcam table " Junfeng Guo
2023-08-21  8:14     ` [PATCH iwl-next v6 07/15] ice: init marker and protocol group tables " Junfeng Guo
2023-08-21  8:14     ` [PATCH iwl-next v6 08/15] ice: init flag redirect table " Junfeng Guo
2023-08-21  8:14     ` [PATCH iwl-next v6 09/15] ice: init XLT key builder " Junfeng Guo
2023-08-21  8:14     ` [PATCH iwl-next v6 10/15] ice: add parser runtime skeleton Junfeng Guo
2023-08-21  8:14     ` [PATCH iwl-next v6 11/15] ice: add internal help functions Junfeng Guo
2023-08-21  8:14     ` [PATCH iwl-next v6 12/15] ice: add parser execution main loop Junfeng Guo
2023-08-21  8:14     ` [PATCH iwl-next v6 13/15] ice: support double vlan mode configure for parser Junfeng Guo
2023-08-21  8:14     ` [PATCH iwl-next v6 14/15] ice: add tunnel port support " Junfeng Guo
2023-08-21  8:14     ` [PATCH iwl-next v6 15/15] ice: add API for parser profile initialization Junfeng Guo
2023-08-23  9:31     ` [PATCH iwl-next v7 00/15] Introduce the Parser Library Junfeng Guo
2023-08-23  9:31       ` [PATCH iwl-next v7 01/15] ice: add parser create and destroy skeleton Junfeng Guo
2023-08-23  9:31       ` [PATCH iwl-next v7 02/15] ice: init imem table for parser Junfeng Guo
2023-08-23  9:31       ` [PATCH iwl-next v7 03/15] ice: init metainit " Junfeng Guo
2023-08-23  9:31       ` [PATCH iwl-next v7 04/15] ice: init parse graph cam tables " Junfeng Guo
2023-08-23  9:31       ` [PATCH iwl-next v7 05/15] ice: init boost tcam and label " Junfeng Guo
2023-08-23  9:31       ` [PATCH iwl-next v7 06/15] ice: init ptype marker tcam table " Junfeng Guo
2023-08-23  9:31       ` [PATCH iwl-next v7 07/15] ice: init marker and protocol group tables " Junfeng Guo
2023-08-23  9:31       ` [PATCH iwl-next v7 08/15] ice: init flag redirect table " Junfeng Guo
2023-08-23  9:31       ` [PATCH iwl-next v7 09/15] ice: init XLT key builder " Junfeng Guo
2023-08-23  9:31       ` [PATCH iwl-next v7 10/15] ice: add parser runtime skeleton Junfeng Guo
2023-08-23  9:31       ` [PATCH iwl-next v7 11/15] ice: add internal help functions Junfeng Guo
2023-08-23  9:31       ` [PATCH iwl-next v7 12/15] ice: add parser execution main loop Junfeng Guo
2023-08-23  9:31       ` [PATCH iwl-next v7 13/15] ice: support double vlan mode configure for parser Junfeng Guo
2023-08-23  9:31       ` [PATCH iwl-next v7 14/15] ice: add tunnel port support " Junfeng Guo
2023-08-23  9:31       ` [PATCH iwl-next v7 15/15] ice: add API for parser profile initialization Junfeng Guo
2023-08-24  7:54       ` [PATCH iwl-next v8 00/15] Introduce the Parser Library Junfeng Guo
2023-08-24  7:54         ` [PATCH iwl-next v8 01/15] ice: add parser create and destroy skeleton Junfeng Guo
2023-08-24  7:54         ` [PATCH iwl-next v8 02/15] ice: init imem table for parser Junfeng Guo
2023-08-28  9:55           ` Ivan Vecera
2023-08-24  7:54         ` [PATCH iwl-next v8 03/15] ice: init metainit " Junfeng Guo
2023-08-24  7:54         ` [PATCH iwl-next v8 04/15] ice: init parse graph cam tables " Junfeng Guo
2023-08-24  7:54         ` [PATCH iwl-next v8 05/15] ice: init boost tcam and label " Junfeng Guo
2023-08-24  7:54         ` [PATCH iwl-next v8 06/15] ice: init ptype marker tcam table " Junfeng Guo
2023-08-24  7:54         ` [PATCH iwl-next v8 07/15] ice: init marker and protocol group tables " Junfeng Guo
2023-08-24  7:54         ` [PATCH iwl-next v8 08/15] ice: init flag redirect table " Junfeng Guo
2023-08-24  7:54         ` [PATCH iwl-next v8 09/15] ice: init XLT key builder " Junfeng Guo
2023-08-24  7:54         ` [PATCH iwl-next v8 10/15] ice: add parser runtime skeleton Junfeng Guo
2023-08-24  7:54         ` [PATCH iwl-next v8 11/15] ice: add internal help functions Junfeng Guo
2023-08-24  7:54         ` [PATCH iwl-next v8 12/15] ice: add parser execution main loop Junfeng Guo
2023-08-24 15:39           ` Simon Horman [this message]
2023-08-24  7:54         ` [PATCH iwl-next v8 13/15] ice: support double vlan mode configure for parser Junfeng Guo
2023-08-24  7:54         ` [PATCH iwl-next v8 14/15] ice: add tunnel port support " Junfeng Guo
2023-08-24  7:55         ` [PATCH iwl-next v8 15/15] ice: add API for parser profile initialization Junfeng Guo
2023-08-24 15:20         ` [PATCH iwl-next v8 00/15] Introduce the Parser Library Jakub Kicinski
2023-08-25 10:52           ` Alexander Lobakin
2023-08-26  0:23             ` Jakub Kicinski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230824153901.GJ3523530@kernel.org \
    --to=horms@kernel.org \
    --cc=anthony.l.nguyen@intel.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=ivecera@redhat.com \
    --cc=jesse.brandeburg@intel.com \
    --cc=junfeng.guo@intel.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=qi.z.zhang@intel.com \
    --cc=sridhar.samudrala@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).