|SUCCESS| lpm: fix SVE bulk lookup loop bound for small bursts
dpdklab at iol.unh.edu
dpdklab at iol.unh.edu
Tue Oct 27 18:03:37 CET 2026
Test-Label: ai-code-review
Test-Status: SUCCESS
https://dpdk.org/patch/172184
_AI Code Review_
=== Patch Review: series.patch (via Claude) ===
Review date: 2026-10-27
# DPDK Patch Review
## Correctness Analysis
### 1. Integer Overflow/Underflow Fixed
The patch correctly identifies and fixes an integer overflow bug in the loop condition:
**Before:**
```c
for (i = 0; i < n - vl; i += vl)
```
**After:**
```c
for (i = 0; i + vl < n; i += vl)
```
When `n < vl`, the original expression `n - vl` wraps to a very large value due to unsigned arithmetic (`n` is `uint32_t`, `vl` is `uint64_t`), causing the loop to read past the end of the `ips[]` array and segfault. The new condition `i + vl < n` avoids the underflow and correctly skips the loop when `n < vl`, relying on the existing tail handling code.
**Verification of the fix:**
- When `n < vl`: `i + vl < n` is false on the first iteration (0 + vl is not < n), so the loop is skipped correctly
- When `n == 0`: same as above, loop is skipped, which is correct
- When `n >= vl`: the loop runs normally
- The tail handling at line 26+ uses `svwhilelt_b32()` which correctly handles the remaining elements
This is a **critical correctness bug fix** (out-of-bounds read, segfault).
## Code Style
No style issues identified. The change is minimal and follows existing patterns.
## API and Documentation
No API changes. No documentation updates required for this internal implementation fix.
## Other Issues
None identified.
---
## Summary
This patch fixes a critical buffer overrun bug in the SVE LPM lookup function that occurs when `n < vl`. The fix is correct and minimal. No other issues found.
Review-Result: CLEAN
More information about the test-report
mailing list