|WARNING| [v6] examples/l3fwd: fix RFC 1812 checks
dpdklab at iol.unh.edu
dpdklab at iol.unh.edu
Fri Nov 13 22:28:53 CET 2026
Test-Label: ai-code-review
Test-Status: WARNING
https://dpdk.org/patch/172886
_AI Code Review_
=== Patch Review: series.patch (via Claude) ===
Review date: 2026-11-13
Review of [PATCH v6] examples/l3fwd: fix RFC 1812 checks
WARNING
1. Unsigned underflow in the Link Layer length passed by both callers.
In `l3fwd_em.h` and `l3fwd_lpm.h`:
```
if (is_valid_ipv4_pkt(ipv4_hdr, m->pkt_len - sizeof(struct rte_ether_hdr),
```
- **Problem:** If `pkt_len` is less than 14, the subtraction wraps to a value near 4G.
- **Why it matters:** Every length check in `is_valid_ipv4_pkt()` then passes:
- `link_len < sizeof(struct rte_ipv4_hdr)`
- the new `link_len < rte_be_to_cpu_16(pkt->total_length)`
That defeats the fix in item 5 of the commit message. `rte_ipv4_cksum()` can again read up to 60 bytes from a runt frame.
- **Fix:** Reject short frames before subtracting, for example:
```c
if (m->pkt_len < sizeof(struct rte_ether_hdr) ||
is_valid_ipv4_pkt(ipv4_hdr, m->pkt_len - sizeof(struct rte_ether_hdr),
m->ol_flags) < 0) {
```
Alternatively, pass `pkt_len` unchanged and subtract inside the function after checking it.
2. Unrelated change to the `lcore_conf` declaration.
In `l3fwd.h`:
```
-extern struct lcore_conf *lcore_conf[RTE_MAX_LCORE];
+extern struct lcore_conf lcore_conf[RTE_MAX_LCORE];
```
- **Problem:** This hunk changes the type of a global from an array of pointers to an array of structs. The commit message does not mention it, and it has nothing to do with the RFC 1812 checks. It looks like a rebase artifact.
- **Why it matters:** The patch carries `Cc: stable at dpdk.org`, so an unexplained type change to a shared global is risky to backport.
- **Fix:** Drop the hunk. If it is genuinely needed, send it as a separate patch with its own justification and Fixes tag.
Review-Result: WARNING
More information about the test-report
mailing list