|WARNING| [4/4] app/dumpcap: do not use rte_exit before EAL init

dpdklab at iol.unh.edu dpdklab at iol.unh.edu
Tue Nov 17 18:28:36 CET 2026


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

_AI Code Review_

=== Patch Review: series.patch (via Claude) ===
Review date: 2026-11-17

**Patch 2/4: app/dumpcap: fix capture duration**

**Warning: converting a large or infinite duration to `uint64_t` is undefined behaviour.**

```c
+		stop_tsc = rte_get_tsc_cycles() +
+			(uint64_t)(stop.duration * rte_get_tsc_hz());
```

`stop.duration` comes straight from `strtod()` on the `-a duration:N` argument. The only check on it is `interval <= 0`, which accepts `"inf"` and very large values such as `1e30`.

When `stop.duration * rte_get_tsc_hz()` exceeds `UINT64_MAX`, converting the double to `uint64_t` is undefined behaviour. In practice the result is often 0 or a small value, so the capture stops immediately. Even when the product fits, adding it to the current TSC can wrap and also stop the capture at once.

Suggested fix: reject non-finite or excessive durations when parsing, for example `!isfinite(interval)` or an upper bound. Alternatively, clamp before the conversion:

```c
	double cycles = stop.duration * rte_get_tsc_hz();
	uint64_t now = rte_get_tsc_cycles();

	if (cycles >= (double)(UINT64_MAX - now))
		stop_tsc = UINT64_MAX;
	else
		stop_tsc = now + (uint64_t)cycles;
```

Review-Result: WARNING


More information about the test-report mailing list