Re: [PATCH net-next v4 2/6] net: enetc: Allocate int_vector array dynamically
From: Simon Horman
Date: Thu Nov 19 2026 - 08:25:16 EST
On Fri, Nov 13, 2026 at 05:02:33PM +0200, Claudiu Manoil wrote:
> The number of Rx/Tx ring interrupt vectors, priv->bdr_int_num, is set
> in enetc_init_si_rings_params() to the lesser of the number of online
> CPUs and the number of Rx rings of the station interface. The
> int_vector[] array in struct enetc_ndev_priv, however, has a fixed
> size of ENETC_MAX_BDR_INT (6), a limit that dates back to the maximum
> CPU count of the SoCs integrating ENETC at the time.
>
> That assumption does not hold for S32N79, which has 8 CPUs and gives
> the ENETC PF up to 8 Rx rings. There, bdr_int_num can reach 8, and
> enetc_alloc_msix() writes priv->int_vector[i] past the end of the
> array, corrupting the adjacent fields of the netdev private area.
> No SoC currently supported upstream exceeds 6 vectors, so this is not
> reachable today; it must be fixed before S32N79 devices can be enabled
> by a following patch.
>
> Allocate int_vector[] with devm_kcalloc() in enetc_alloc_msix(), once
> bdr_int_num is known. The memory is released together with the PCI
> device, so no explicit free is needed on the error or teardown paths.
> This is common code, so the PF and VF drivers benefit alike. Drop the
> ENETC_MAX_BDR_INT define, which only existed to size this array.
>
> Signed-off-by: Claudiu Manoil <claudiu.manoil@xxxxxxx>
Reviewed-by: Simon Horman <horms@xxxxxxxxxx>