Thread (6 messages) 6 messages, 2 authors, 2023-02-14

Re: [PATCH net-next v3 1/4] sfc: store PTP filters in a list

From: Edward Cree <ecree.xilinx@gmail.com>
Date: 2023-02-14 16:08:36

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 <redacted>
Signed-off-by: Íñigo Huguet <redacted>
...
quoted hunk ↗ jump to hunk
@@ -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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help