public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: rkannoth@marvell.com
Cc: Jakub Kicinski <kuba@kernel.org>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [net-next,v3,04/13] ocetontx2-af: npc: cn20k: MKEX profile support
Date: Sat, 10 Jan 2026 14:59:32 -0800	[thread overview]
Message-ID: <20260110225932.3900827-1-kuba@kernel.org> (raw)
In-Reply-To: <20260109054828.1822307-5-rkannoth@marvell.com>

This is an AI-generated review of your patch. The human sending this
email has considered the AI review valid, or at least pausible.

For local reproduction steps see https://netdev-ai.bots.linux.dev/ai-local.html
---
ocetontx2-af: npc: cn20k: MKEX profile support

This patch adds MKEX profile support for the cn20k silicon variant,
introducing a new key extractor concept with up to 24 extractors per
packet parsing profile.

> diff --git a/drivers/net/ethernet/marvell/octeontx2/af/cn20k/npc.c b/drivers/net/ethernet/marvell/octeontx2/af/cn20k/npc.c
> index 316e6cd1436a..88d7f65d246c 100644
> --- a/drivers/net/ethernet/marvell/octeontx2/af/cn20k/npc.c
> +++ b/drivers/net/ethernet/marvell/octeontx2/af/cn20k/npc.c

[ ... ]

> +void npc_cn20k_load_mkex_profile(struct rvu *rvu, int blkaddr,
> +				 const char *mkex_profile)
> +{
> +	struct npc_mcam_kex_extr *mcam_kex_extr;
> +	struct device *dev = &rvu->pdev->dev;
> +	void __iomem *mkex_prfl_addr = NULL;
> +	u64 prfl_sz;
> +	int ret;
> +
> +	/* If user not selected mkex profile */
> +	if (rvu->kpu_fwdata_sz ||
> +	    !strncmp(mkex_profile, cn20k_def_pfl_name, MKEX_NAME_LEN))
> +		goto program_mkex_extr;
> +
> +	/* Setting up the mapping for mkex profile image */
> +	ret = npc_fwdb_prfl_img_map(rvu, &mkex_prfl_addr, &prfl_sz);
> +	if (ret < 0)
> +		goto program_mkex_extr;
> +
> +	mcam_kex_extr = (struct npc_mcam_kex_extr __force *)mkex_prfl_addr;
> +
> +	while (((s64)prfl_sz > 0) && (mcam_kex_extr->mkex_sign != MKEX_END_SIGN)) {
> +		/* Compare with mkex mod_param name string */
> +		if (mcam_kex_extr->mkex_sign == MKEX_CN20K_SIGN &&
> +		    !strncmp(mcam_kex_extr->name, mkex_profile, MKEX_NAME_LEN)) {
> +			rvu->kpu.mcam_kex_prfl.mkex_extr = mcam_kex_extr;
> +			goto program_mkex_extr;
> +		}
> +
> +		mcam_kex_extr++;
> +		prfl_sz -= sizeof(struct npc_mcam_kex);
                                 ^^^^^^^^^^^^^^^^^^^^^

The loop iterates over struct npc_mcam_kex_extr entries (the pointer
mcam_kex_extr is advanced by sizeof(struct npc_mcam_kex_extr) via
mcam_kex_extr++), but the size decrement uses sizeof(struct npc_mcam_kex).

These structures have different sizes:
- struct npc_mcam_kex_extr contains intf_extr_lid[2][24] and
  intf_extr_lt[2][24][16] arrays
- struct npc_mcam_kex contains intf_lid_lt_ld[2][8][16][2] and
  intf_ld_flags[2][2][16] arrays

Should this be sizeof(struct npc_mcam_kex_extr) to match the pointer
increment? Otherwise the loop termination condition will be incorrect
and could read beyond the profile buffer boundaries.

> +	}
> +	dev_warn(dev, "Failed to load requested profile: %s\n", mkex_profile);

[ ... ]

  reply	other threads:[~2026-01-10 22:59 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-09  5:48 [PATCH net-next v3 00/13] NPC HW block support for cn20k Ratheesh Kannoth
2026-01-09  5:48 ` [PATCH net-next v3 01/13] octeontx2-af: npc: cn20k: Index management Ratheesh Kannoth
2026-01-10 22:51   ` Jakub Kicinski
2026-01-13 10:08     ` Ratheesh Kannoth
2026-01-10 22:58   ` Jakub Kicinski
2026-01-13 10:29     ` Ratheesh Kannoth
2026-01-13 15:07       ` Jakub Kicinski
2026-01-14  5:52         ` Ratheesh Kannoth
2026-01-15  3:14           ` Jakub Kicinski
2026-01-10 22:59   ` [net-next,v3,01/13] " Jakub Kicinski
2026-01-13 10:08     ` Ratheesh Kannoth
2026-01-09  5:48 ` [PATCH net-next v3 02/13] octeontx2-af: npc: cn20k: KPM profile changes Ratheesh Kannoth
2026-01-09  5:48 ` [PATCH net-next v3 03/13] octeontx2-af: npc: cn20k: Add default profile Ratheesh Kannoth
2026-01-09  5:48 ` [PATCH net-next v3 04/13] ocetontx2-af: npc: cn20k: MKEX profile support Ratheesh Kannoth
2026-01-10 22:59   ` Jakub Kicinski [this message]
2026-01-13 10:02     ` [net-next,v3,04/13] " Ratheesh Kannoth
2026-01-09  5:48 ` [PATCH net-next v3 05/13] octeontx2-af: npc: cn20k: Allocate default MCAM indexes Ratheesh Kannoth
2026-01-10 22:52   ` Jakub Kicinski
2026-01-13  9:58     ` Ratheesh Kannoth
2026-01-10 22:59   ` [net-next,v3,05/13] " Jakub Kicinski
2026-01-13  9:56     ` Ratheesh Kannoth
2026-01-09  5:48 ` [PATCH net-next v3 06/13] octeontx2-af: npc: cn20k: Use common APIs Ratheesh Kannoth
2026-01-09  5:48 ` [PATCH net-next v3 07/13] octeontx2-af: npc: cn20k: Prepare for new SoC Ratheesh Kannoth
2026-01-09  5:48 ` [PATCH net-next v3 08/13] octeontx2-af: npc: cn20k: Add new mailboxes for CN20K silicon Ratheesh Kannoth
2026-01-09  5:48 ` [PATCH net-next v3 09/13] octeontx2-af: npc: cn20k: virtual index support Ratheesh Kannoth
2026-01-10 22:52   ` Jakub Kicinski
2026-01-13 10:09     ` Ratheesh Kannoth
2026-01-09  5:48 ` [PATCH net-next v3 10/13] octeontx2-af: npc: cn20k: Allocate MCAM entry for flow installation Ratheesh Kannoth
2026-01-09  5:48 ` [PATCH net-next v3 11/13] octeontx2-pf: cn20k: Add TC rules support Ratheesh Kannoth
2026-01-10 22:59   ` [net-next,v3,11/13] " Jakub Kicinski
2026-01-13  9:54     ` Ratheesh Kannoth
2026-01-09  5:48 ` [PATCH net-next v3 12/13] octeontx2-af: npc: cn20k: add debugfs support Ratheesh Kannoth
2026-01-09  5:48 ` [PATCH net-next v3 13/13] octeontx2-af: npc: Use common structures Ratheesh Kannoth

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=20260110225932.3900827-1-kuba@kernel.org \
    --to=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=rkannoth@marvell.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