|WARNING| crypto/cnxk: fix AE table get on unprobed device

dpdklab at iol.unh.edu dpdklab at iol.unh.edu
Fri Oct 9 14:55:57 CEST 2026


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

_AI Code Review_

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

# Review of DPDK Patch: crypto/cnxk AE table get fixes

## Summary
This patch fixes NULL pointer dereference bugs in two API functions that failed to validate the device ID before dereferencing `dev->data`. The fix is correct and addresses a real correctness issue.

---

## ERRORS

None.

---

## WARNINGS

### 1. Missing `__rte_experimental` tag verification
**File:** drivers/crypto/cnxk/cnxk_cryptodev_ops.c

The patch modifies `rte_pmd_cnxk_ae_fpm_table_get()` and `rte_pmd_cnxk_ae_ec_grp_table_get()`, which appear to be public API functions based on their `rte_pmd_` prefix. Verify that these functions are properly marked with `__rte_experimental` in the header file (not shown in patch) and have corresponding `RTE_EXPORT_EXPERIMENTAL_SYMBOL(name, version)` macros in this source file.

**Current code:** No export macro visible in the diff context.

**Required (if these are new/experimental functions):**
```c
RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_pmd_cnxk_ae_fpm_table_get, XX.XX)
void *
rte_pmd_cnxk_ae_fpm_table_get(uint8_t dev_id)
{
    /* ... */
}

RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_pmd_cnxk_ae_ec_grp_table_get, XX.XX)
void *
rte_pmd_cnxk_ae_ec_grp_table_get(uint8_t dev_id, uint16_t *nb_max_entries)
{
    /* ... */
}
```

---

## INFO

### 1. Consistent error message formatting
**File:** drivers/crypto/cnxk/cnxk_cryptodev_ops.c (line 1156)

The new error message uses "nb_max_entries pointer" while other messages use the parameter name directly. Consider using just "nb_max_entries" for consistency with existing code style:

**Current:**
```c
plt_err("Invalid nb_max_entries pointer");
```

**Suggested:**
```c
plt_err("nb_max_entries is NULL");
```

This matches the existing pattern where parameter names are used directly in error messages.

---

## POSITIVE FINDINGS

### Correctness improvements (the patch fixes real bugs):

1. **Proper device validation**: Using `rte_cryptodev_is_valid_dev()` before `rte_cryptodev_pmd_get_dev()` correctly prevents NULL dereference on `dev->data` when an invalid dev_id is passed.

2. **NULL pointer check added**: The `nb_max_entries` parameter check prevents a potential NULL pointer dereference when the output parameter is NULL.

3. **Consistent pattern**: Both functions now follow the same validation sequence (validate inputs, validate dev_id, get device, check dev_private).

4. **Proper error messages**: All error paths log appropriate diagnostics before returning NULL.

---

## CONCLUSION

The patch correctly fixes the NULL pointer dereference bugs described in the commit message. The core logic is sound. The only concern is verification that the API export macros are present (Warning #1), which requires reviewing the full source file, not just the diff context.


More information about the test-report mailing list