|WARNING| [3/3] vhost: remove use of strncpy

dpdklab at iol.unh.edu dpdklab at iol.unh.edu
Tue Jun 23 21:51:45 CEST 2026


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

_AI Code Review_

=== Patch Review: series.patch (via Claude) ===
Review date: 2026-06-23

# DPDK Patch Review

## PATCH 1/3: ethdev: remove use of strncpy

### Errors

None.

### Warnings

**Bounds check potentially ineffective for nested calls**

The added bounds check `if (len < 2 || (len - 2) >= BUFSIZ)` guards against underflow and overflow for the immediate `memcpy()`, but the subsequent code tokenizes the copied string and calls functions that may write to `da_val` (also sized `BUFSIZ`). The check protects the initial copy but not the downstream parsing. Verify that tokenization cannot produce strings longer than `BUFSIZ` to avoid later buffer overruns.

---

## PATCH 2/3: eventdev: improve bounds checks for names in adapter create

### Errors

None.

### Warnings

None.

---

## PATCH 3/3: vhost: remove use of strncpy

### Errors

**`vhost_set_ifname()` signature change breaks callers**

The function signature changed from `vhost_set_ifname(int vid, const char *if_name, unsigned int if_len)` to `vhost_set_ifname(int vid, const char *if_name)`, removing the `if_len` parameter. The patch updates the two call sites in `socket.c` and `vduse.c`, but does not verify whether there are other callers in the codebase. If any external callers exist (in drivers or examples), they will fail to compile. Confirm that no other call sites exist before merging.

### Warnings

**`len` computation in `rte_vhost_get_ifname()` now redundant**

The line `len = RTE_MIN(len, sizeof(dev->ifname));` computes a clamped length before calling `strlcpy()`, but `strlcpy()` already truncates to the destination buffer size. The explicit `RTE_MIN()` is now redundant and can be removed, passing `len` directly to `strlcpy()`. This is a minor cleanup opportunity, not a bug.

---

## Summary

**PATCH 1/3**: One Warning (verify downstream tokenization bounds).

**PATCH 2/3**: No issues found.

**PATCH 3/3**: One Error (potential missing callers for signature change), one Warning (redundant length computation).

The most critical issue is verifying that the `vhost_set_ifname()` signature change does not break compilation elsewhere in the DPDK tree. The other findings are minor improvements or verification requests.


More information about the test-report mailing list