[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <85284c1a-d6ab-321b-570e-e9392979ab0d@gmail.com>
Date: Tue, 14 Feb 2023 16:08:27 +0000
From: Edward Cree <ecree.xilinx@...il.com>
To: Íñigo Huguet <ihuguet@...hat.com>,
habetsm.xilinx@...il.com, richardcochran@...il.com
Cc: davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org,
pabeni@...hat.com, netdev@...r.kernel.org,
Yalin Li <yalli@...hat.com>
Subject: Re: [PATCH net-next v3 1/4] sfc: store PTP filters in a list
On 09/02/2023 10:43, Íñigo Huguet wrote:
> Instead of using a fixed sized array for the PTP filters, use a list.
>
> This is not actually necessary at this point because the filters for
> multicast PTP are a fixed number, but this is a preparation for the
> following patches adding support for unicast PTP.
>
> To avoid confusion with the new struct type efx_ptp_rxfilter, change the
> name of some local variables from rxfilter to spec, given they're of the
> type efx_filter_spec.
>
> Reported-by: Yalin Li <yalli@...hat.com>
> Signed-off-by: Íñigo Huguet <ihuguet@...hat.com>
...
> @@ -1311,48 +1320,55 @@ static void efx_ptp_init_filter(struct efx_nic *efx,
> }
>
> static int efx_ptp_insert_filter(struct efx_nic *efx,
> - struct efx_filter_spec *rxfilter)
> + struct efx_filter_spec *spec)
> {
> struct efx_ptp_data *ptp = efx->ptp_data;
> + struct efx_ptp_rxfilter *rxfilter;
>
> - int rc = efx_filter_insert_filter(efx, rxfilter, true);
> + int rc = efx_filter_insert_filter(efx, spec, true);
> if (rc < 0)
> return rc;
> - ptp->rxfilters[ptp->rxfilters_count] = rc;
> - ptp->rxfilters_count++;
> +
> + rxfilter = kzalloc(sizeof(*rxfilter), GFP_KERNEL);
> + if (!rxfilter)
> + return -ENOMEM;
Doesn't this leak the filter?
I'd be tempted to put the malloc first, that way in the failure
ladder we'll only be doing a free, not a filter removal that
may involve MCDI.
Apart from that, patch (and series) LGTM.
-ed
Powered by blists - more mailing lists