|WARNING| [v2] net/netvsc: fix event buffer leak on realloc failure

dpdklab at iol.unh.edu dpdklab at iol.unh.edu
Sat Oct 31 10:36:13 CET 2026


Test-Label: ai-code-review
Test-Status: WARNING
https://dpdk.org/patch/172325

_AI Code Review_

=== Patch Review: series.patch (via Claude) ===
Review date: 2026-10-31

# DPDK Patch Review

## ERRORS

None identified.

## WARNINGS

**Missing release notes update:**
The patch fixes a memory leak (a correctness bug) in the netvsc driver.
Bug fixes that affect driver behavior should be documented in the current release notes.
Add an entry to `doc/guides/rel_notes/release_<current>.rst` under the "Fixed Issues" section
describing the event buffer leak fix.

## INFO

**Good fix for resource leak:**
The patch correctly prevents a memory leak when `rte_realloc()` fails.
The old pattern overwrote `rxq->event_buf` before checking the return value,
making the original buffer unreachable.
The new pattern uses a temporary pointer (`new_buf`), checks for NULL,
and only updates `rxq->event_buf` and `rxq->event_sz` on success.
This preserves the existing buffer and allows retry on the next event loop iteration.

**Appropriate use of explicit NULL check:**
```c
if (new_buf == NULL)
```
This is the correct DPDK style for pointer comparison.

**Error path cleanup is correct:**
On allocation failure, the code breaks from the loop, leaving the old buffer intact.
The existing buffer remains allocated and will be freed when the queue is torn down
(presumably in a cleanup function not shown in this patch).
No resource is leaked.

**Pre-existing: error path zeroes event_sz (removed by this patch):**
The old code set `rxq->event_sz = 0` on allocation failure,
which would cause the next iteration to skip the size check and attempt to read into a NULL buffer
(if the old event_buf had also been lost).
This patch removes that line, which is correct --
the old size and buffer are preserved instead.
This is not introduced by the patch, so it is mentioned here only as context for the fix.

Review-Result: WARNING


More information about the test-report mailing list