|WARNING| cfgfile: fix isspace() undefined behavior
dpdklab at iol.unh.edu
dpdklab at iol.unh.edu
Sat Oct 24 19:37:06 CEST 2026
Test-Label: ai-code-review
Test-Status: WARNING
https://dpdk.org/patch/172056
_AI Code Review_
=== Patch Review: series.patch (via Claude) ===
Review date: 2026-10-24
# DPDK Patch Review
## ERRORS
**Syntax error in control flow**
Line 109: Missing semicolon before the "do nothing" comment.
```c
while (isspace((unsigned char)str[start]) && start < newlen)
start++
; /* do nothing */
```
The `start++` statement is not followed by a semicolon. This should be:
```c
while (isspace((unsigned char)str[start]) && start < newlen)
start++;
```
The standalone semicolon with the "do nothing" comment is unnecessary and creates ambiguity about whether it's part of the loop body or a mistake. The fix correctly adds casts for the UB issue but introduces a compilation error.
---
## Analysis
### Correctness
The patch correctly identifies and fixes undefined behavior in the `isspace()` calls. The C standard requires `isspace()` and other `<ctype.h>` functions to accept `int` values representable as `unsigned char` or `EOF`. Passing a negative `int` (from sign extension of a `char` with high bit set) is undefined behavior and can cause out-of-bounds access to the ctype lookup table.
The cast to `unsigned char` is the standard idiom for this fix and matches existing practice in the DPDK codebase (`test_bbdev_vector.c` as cited).
However, the syntax error on line 109 makes this patch fail to compile.
### Process
- `Fixes:` tag present and correct
- `Cc: stable at dpdk.org` present and appropriate for a UB fix
- Release notes: This is a bug fix for internal library code, so no release notes are required
---
Review-Result: ERROR
More information about the test-report
mailing list