|WARNING| [2/2] net/i40e: fix FDIR memzone leak
dpdklab at iol.unh.edu
dpdklab at iol.unh.edu
Fri Oct 23 13:12:11 CEST 2026
Test-Label: ai-code-review
Test-Status: WARNING
https://dpdk.org/patch/171889
_AI Code Review_
=== Patch Review: series.patch (via Claude) ===
Review date: 2026-10-23
# DPDK Patch Review
## Patch 1/2: net/i40e: fix floating VEB leak
### ERRORS
None identified.
### WARNINGS
None identified.
### INFO
The fix appears correct. The patch adds a call to `i40e_veb_release()` to free the floating VEB structure after releasing its attached VSIs, matching the pattern already used for regular VEBs elsewhere in the codebase. The placement after the loop that releases VSIs is appropriate.
---
## Patch 2/2: net/i40e: fix FDIR memzone leak
### ERRORS
**Resource leak on error path**
In `i40e_fdir_setup()`, the memzone `mz` is reserved early in the function but the new assignment `pf->fdir.prg_mz = mz;` occurs only after all setup steps succeed. If any of the intermediate setup operations fail (VSI setup, queue setup, etc.) and cause an early `return` before line 244, the memzone will be leaked because it has not yet been stored in `pf->fdir.prg_mz` and therefore `i40e_fdir_teardown()` cannot free it.
**Suggested fix:** Move the `pf->fdir.prg_mz = mz;` assignment to immediately after the memzone reservation succeeds, before any operations that can fail:
```c
/* reserve memory for the flow director programming packet */
snprintf(z_name, sizeof(z_name), "%s_%s_%d",
eth_dev->device->driver->name,
I40E_FDIR_MZ_NAME,
eth_dev->data->port_id);
mz = i40e_memzone_reserve(z_name, I40E_FDIR_PKT_LEN *
I40E_FDIR_PRG_PKT_CNT, SOCKET_ID_ANY);
if (mz == NULL) {
PMD_DRV_LOG(ERR, "Cannot init memory zone.");
return I40E_ERR_NO_MEMORY;
}
memset(mz->addr, 0, I40E_FDIR_PKT_LEN * I40E_FDIR_PRG_PKT_CNT);
pf->fdir.prg_mz = mz; // Move this here, before any failable operations
/* Allocate the RX queue data structure. */
pf->fdir.rxq = rte_zmalloc_socket("i40e fdir rx queue",
sizeof(struct ci_rx_queue),
RTE_CACHE_LINE_SIZE,
SOCKET_ID_ANY);
if (pf->fdir.rxq == NULL) {
i40e_fdir_teardown(pf); // Will now correctly free mz
return -ENOMEM;
}
// ... rest of setup
```
This ensures that if any subsequent allocation or setup step fails and calls `i40e_fdir_teardown()` (as several error paths already do), the memzone will be properly freed.
Review-Result: ERROR
More information about the test-report
mailing list