Re: [PATCH net-next] idpf: Slightly simplify memory management in idpf_add_del_mac_filters()
From: Simon Horman
Date: Fri Aug 23 2024 - 12:16:00 EST
On Fri, Aug 23, 2024 at 08:23:29AM +0200, Christophe JAILLET wrote:
> In idpf_add_del_mac_filters(), filters are chunked up into multiple
> messages to avoid sending a control queue message buffer that is too large.
>
> Each chunk has up to IDPF_NUM_FILTERS_PER_MSG entries. So except for the
> last iteration which can be smaller, space for exactly
> IDPF_NUM_FILTERS_PER_MSG entries is allocated.
>
> There is no need to free and reallocate a smaller array just for the last
> iteration.
>
> This slightly simplifies the code and avoid an (unlikely) memory allocation
> failure.
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@xxxxxxxxxx>
Reviewed-by: Simon Horman <horms@xxxxxxxxxx>