|SUCCESS| [v2] sched: fix infinite loop in rational approximation

dpdklab at iol.unh.edu dpdklab at iol.unh.edu
Thu Nov 26 08:26:54 CET 2026


Test-Label: ai-code-review
Test-Status: SUCCESS
https://dpdk.org/patch/173188

_AI Code Review_

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

No correctness bugs found. The bounds are right: denum <= 10^4 keeps denum2 inside `uint32_t`, and denum <= 10^9 keeps it inside `uint64_t`. The two test comments ("below 1e-4" and "below 1e-9") match these limits.

Info

1. Public API behaviour change is undocumented (lib/sched/rte_approx.c).
   `rte_approx()` now returns -1 for any `d < 1e-4`, and `rte_approx_64()` for any `d < 1e-9`:
   ```
   +	if (denum > UINT32_MAX / denum)
   +		return -1;
   ```
   Some requests in these ranges used to terminate with a valid answer, for example `rte_approx(0.125, 1e-5, ...)`, and are now rejected.
   - Consider stating the minimum supported `d` for each variant in the Doxygen of `rte_approx.h`.
   - Callers then know the limit up front instead of discovering it as an error return.

2. Redundant newlines in test assert messages (app/test/test_sched.c).
   The `TEST_ASSERT_*` macros already append a newline, so the trailing `\n` gives a blank line on failure:
   ```
   +	TEST_ASSERT_FAIL(err, "rte_approx accepted unrepresentable d\n");
   ```
   Drop the `\n` from these messages.

3. Use `TEST_SUCCESS` in `test_sched_approx()`.
   The function ends with `return 0;`; returning `TEST_SUCCESS` would match the `TEST_SKIPPED` return used in the Windows stub.

Review-Result: CLEAN


More information about the test-report mailing list