|WARNING| [v2] net/bnxt: validate pool index in pool manager APIs

dpdklab at iol.unh.edu dpdklab at iol.unh.edu
Tue Oct 13 08:50:56 CEST 2026


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

_AI Code Review_

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

# DPDK Patch Review

## ERRORS

None identified.

## WARNINGS

**Format specifier mismatch in error messages:**
The error log messages use `%u` for `pool_id` and `ctx->max_pools`, both of which are `uint16_t`. The guideline requires using `PRIu16` for `uint16_t` types, but the v2 changelog explicitly states "Use %u for the new log messages instead of PRIu16" as an intentional change from v1.

However, `%u` expects `unsigned int` while `uint16_t` is typically `unsigned short` on many platforms. This creates a type mismatch. While integer promotion makes `%u` work on common platforms, it is not portable and violates the format specifier guidelines for fixed-width types.

**Suggested fix:**
```c
CFA_LOG_ERR("pool_id (%" PRIu16 ") out of range (max %" PRIu16 ")\n",
            pool_id, ctx->max_pools);
```

And restore the `<inttypes.h>` include at the top of the file (if not already present transitively).

## INFO

**Consistent pattern applied correctly:**
The patch adds the same `pool_id >= ctx->max_pools` bounds check to three functions (`cfa_tpm_free`, `cfa_tpm_fid_add`, `cfa_tpm_fid_rem`). This is correct -- all three functions dereference `ctx->fid_tbl[pool_id]` after the new check, so the validation prevents an out-of-bounds array access. The placement (after the `ctx == NULL` check, before the array access) is appropriate.

**Error messages are clear:**
The log messages correctly identify both the invalid value and the valid range, making debugging straightforward.

Review-Result: WARNING


More information about the test-report mailing list