|SUCCESS| [v3] fib6: fix overflow of tbl8 indexes
dpdklab at iol.unh.edu
dpdklab at iol.unh.edu
Tue Nov 3 02:20:00 CET 2026
Test-Label: ai-code-review
Test-Status: SUCCESS
https://dpdk.org/patch/172355
_AI Code Review_
=== Patch Review: series.patch (via Claude) ===
Review date: 2026-11-03
# DPDK Patch Review
## ERRORS
None identified.
## WARNINGS
None identified.
## INFO
### Correctness Review
The patch addresses a genuine integer overflow/truncation issue in the FIB6 trie implementation. The analysis is thorough:
1. **Sign extension bug (< 2^24 groups)**: An int storing a tbl8 index becomes negative at group 2^23, causing SIGSEGV when sign-extended to uint64_t.
2. **Truncation bug (>= 2^24 groups)**: The tbl8 index computation in get_idx() yields a 64-bit result truncated to uint32_t on return, causing routes to be written to wrong groups.
The fix is correct:
- **Widening to uint64_t**: Functions manipulating tbl8 entry indexes (get_idx, get_tbl_val_by_idx, get_tbl_pos, get_psd_idx, install_to_dp) now use uint64_t to prevent truncation.
- **Separate signed variable for error checking**: In build_common_root() and write_edge(), a separate `int tbl8_idx` receives the tbl8_alloc() result (negative on error), then is checked and explicitly cast to uint64_t before the shift. This avoids undefined behavior from left-shifting a negative value.
- **Cast before shift**: Lines 333 and 365 now cast to uint64_t before the left shift, preventing integer overflow in the shift operation itself (the original `(idx << 1)` with idx being int could overflow before widening).
The commit message accurately describes both failure modes and the solution. The test validation (1.36M routes) confirms the fix works.
### Style and Clarity
The code follows DPDK style. Variable naming is clear: `tbl8_idx` for the allocation result (which can be negative), `idx`/`prev_idx` for the computed 64-bit table entry indexes.
The separate handling of error codes vs. computed indexes is a standard defensive pattern and improves clarity.
### Documentation
This is a bug fix in an existing internal implementation. No API changes, no new features, no release notes required beyond what the commit message provides.
Review-Result: CLEAN
More information about the test-report
mailing list