Re: [PATCH net] octeontx2-af: mcs: Fix unsupported secy stats read
From: Simon Horman
Date: Wed Jun 03 2026 - 13:09:19 EST
From: 'Simon Horman' <horms@xxxxxxxxxx>
This is an AI-generated review of your patch. The human sending this
email has considered the AI review valid, or at least plausible.
Full review at: https://sashiko.dev
---
octeontx2-af: mcs: Fix unsupported secy stats read
This commit updates mcs_get_rx_secy_stats() to skip reading the Secy
control stats counter on CNF10KB platforms, since the register does
not exist.
> diff --git a/drivers/net/ethernet/marvell/octeontx2/af/mcs.c b/drivers/net/ethernet/marvell/octeontx2/af/mcs.c
> index c1775bd01c2b4..a07e0b3d8d000 100644
> --- a/drivers/net/ethernet/marvell/octeontx2/af/mcs.c
> +++ b/drivers/net/ethernet/marvell/octeontx2/af/mcs.c
> @@ -120,13 +120,13 @@ void mcs_get_rx_secy_stats(struct mcs *mcs, struct mcs_secy_stats *stats, int id
> reg = MCSX_CSE_RX_MEM_SLAVE_INPKTSSECYUNTAGGEDX(id);
> stats->pkt_untaged_cnt = mcs_reg_read(mcs, reg);
>
> - reg = MCSX_CSE_RX_MEM_SLAVE_INPKTSSECYCTLX(id);
> - stats->pkt_ctl_cnt = mcs_reg_read(mcs, reg);
> -
> if (mcs->hw->mcs_blks > 1) {
> reg = MCSX_CSE_RX_MEM_SLAVE_INPKTSSECYNOTAGX(id);
> stats->pkt_notag_cnt = mcs_reg_read(mcs, reg);
> + return;
[Severity: Medium]
Will this early return cause an uninitialized memory leak in debugfs?
In rvu_debugfs.c, rvu_dbg_mcs_rx_secy_stats_display() allocates the stats
structure on the stack without zero-initializing it, and passes it to
mcs_get_rx_secy_stats() to be populated.
Since the early return now skips setting stats->pkt_ctl_cnt, and the caller
unconditionally prints it via seq_printf(), could this result in leaking
uninitialized stack memory to userspace when the debugfs file is read?
> }
> + reg = MCSX_CSE_RX_MEM_SLAVE_INPKTSSECYCTLX(id);
> + stats->pkt_ctl_cnt = mcs_reg_read(mcs, reg);
> }