|WARNING| acl: reject rules with inverted range
dpdklab at iol.unh.edu
dpdklab at iol.unh.edu
Tue Nov 10 08:07:22 CET 2026
Test-Label: ai-code-review
Test-Status: WARNING
https://dpdk.org/patch/172791
_AI Code Review_
=== Patch Review: series.patch (via Claude) ===
Review date: 2026-11-10
# DPDK Patch Review
## Summary
This patch adds validation for RANGE fields in ACL rules to prevent crashes and incorrect behavior when the low bound exceeds the high bound. The implementation is correct and fixes a real bug.
---
## CORRECTNESS
No correctness bugs found. The patch properly validates range fields and returns errors appropriately.
---
## STYLE
### **Warning: Explicit comparison needed**
**Line: `if ((rule->data.category_mask & bcx->category_mask) != 0) {`**
DPDK style requires explicit comparison against zero for integer results. While the existing code already uses `!= 0`, which is correct, the new code in `acl_check_rule_ranges()` should follow the same pattern consistently.
**Current code:**
```c
if (lo > hi) {
```
**Should be:**
```c
if (lo > hi) {
```
Actually, this comparison is already explicit (comparing two integers directly), so this is fine. The guideline about explicit comparison primarily applies to pointer and integer truthiness checks like `if (p)` vs `if (p != NULL)`.
---
## API AND DOCUMENTATION
### **Warning: Missing release notes**
This patch fixes a significant bug (crashes and incorrect matching) in a stable API. It should include an update to the current release notes (`doc/guides/rel_notes/release_XX_YY.rst`) documenting the bug fix under a "Fixed Issues" section.
**Suggested addition to release notes:**
```rst
* **acl: Fixed crash and incorrect matching with inverted range rules.**
Fixed a bug where ACL rules with inverted range fields (low > high) would
either crash during build (1-byte fields) or incorrectly match all values
(2-byte fields). Such rules are now properly rejected with -EINVAL.
```
---
## TEST COVERAGE
The patch includes appropriate test coverage through the existing test framework, adding validation for the generic API path. The test properly exercises the error case.
---
## PROCESS
### **Info: Stable backport candidate**
The patch is correctly tagged with `Cc: stable at dpdk.org` and includes a `Fixes:` tag. This is appropriate for a bug fix that addresses crashes and incorrect behavior.
---
## OBSERVATIONS
**Info: Code quality**
The implementation correctly:
- Validates range fields at build time where the configuration is known
- Handles all field sizes (uint8_t, uint16_t, uint32_t, uint64_t)
- Returns appropriate error code (-EINVAL)
- Logs descriptive error messages
- Adds test coverage for the bug fix
The switch statement properly promotes narrow types to uint64_t for comparison, avoiding any truncation issues.
---
Review-Result: WARNING
More information about the test-report
mailing list