|WARNING| [v2] net/bnxt: add response bounds checks for TruFlow messages

dpdklab at iol.unh.edu dpdklab at iol.unh.edu
Tue Oct 13 21:59:00 CEST 2026


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

_AI Code Review_

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

# DPDK Patch Review

## Errors

**1. Missing bounds check before memcpy in tf_msg_get_tbl_entry()**

Line: `tfp_memcpy(data, resp.data, size);` (around line 1444 based on context)

The patch adds a bounds check at the top of `tf_msg_get_tbl_entry()`:
```c
if (size > sizeof(resp.data))
    return -EINVAL;
```

However, the actual `tfp_memcpy()` call that uses this `size` parameter is not visible in the patch diff. The bounds check protects against oversized caller-supplied `size`, but we cannot verify from the diff that the subsequent memcpy uses the same `size` value. If the memcpy uses a different variable (e.g., `resp_size` as seen in `tf_msg_get_global_cfg()`), the check would be ineffective.

**Recommendation:** Verify that the memcpy in `tf_msg_get_tbl_entry()` uses the `size` parameter directly, not a re-derived field. If it uses a different variable, either change the memcpy to use `size` (as done in the other two functions) or also validate that variable.

---

## Warnings

None.

---

## Info

**1. Inconsistent parameter naming pattern**

The three functions use different naming for the size parameter:
- `tf_msg_get_tbl_entry()`: `size` (appears to be a function parameter)
- `tf_msg_get_global_cfg()`: `params->config_sz_in_bytes`
- `tf_msg_get_if_tbl_entry()`: `params->data_sz_in_bytes`

While this is pre-existing inconsistency and not introduced by the patch, future refactoring could benefit from uniform naming across these similar functions.

**2. Error code consistency**

All three validation checks return `-EINVAL` on bounds violation, which is appropriate and consistent.

**3. Positive security improvement**

The patch correctly addresses a stack over-read vulnerability by validating caller-supplied sizes against fixed response buffer capacity. The approach of checking at function entry and using the validated caller size in the memcpy (for the latter two functions) is sound.

---

## Summary

The patch addresses a real security issue (stack over-read from unbounded caller-supplied sizes) and the fixes to `tf_msg_get_global_cfg()` and `tf_msg_get_if_tbl_entry()` are correct and complete. However, there is insufficient context in the diff to verify that the bounds check in `tf_msg_get_tbl_entry()` actually protects the corresponding memcpy. This needs verification by examining the full function implementation.

Review-Result: ERROR


More information about the test-report mailing list