|SUCCESS| [v2] sched: fix infinite loop in rational approximation
dpdklab at iol.unh.edu
dpdklab at iol.unh.edu
Thu Nov 26 08:20:53 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
Review of [PATCH v2] sched: fix infinite loop in rational approximation
The fix itself looks correct. Both new checks run before any multiplication: `denum > UINT32_MAX / 10` and `denum > UINT32_MAX / denum` (and their 64-bit counterparts). `denum` is always at least 1, so the division is safe.
Info
1. The new precision limits are not documented in the API.
The patch adds new rejection conditions:
```
+ if (denum > UINT32_MAX / denum)
+ return -1;
```
These limits are roughly d >= 1e-4 for `rte_approx()` and d >= 1e-9 for `rte_approx_64()`. Callers will now get -1 for inputs that used to be accepted, such as `rte_approx()` with d = 1e-6. Consider noting the minimum supported precision in the Doxygen for both functions in `rte_approx.h`, so callers know why a request fails.
2. The new test is a separate standalone test rather than part of a suite.
```
+REGISTER_FAST_TEST(sched_approx_autotest, NOHUGE_OK, ASAN_OK,
+ test_sched_approx);
```
This matches the existing style of `test_sched()` in this file, so it is not wrong. If the file is later converted to `unit_test_suite_runner`, the approx checks could become individual `TEST_CASE` entries in the same suite.
3. The assertion messages end with "\n".
```
+ TEST_ASSERT_FAIL(err, "rte_approx accepted unrepresentable d\n");
```
`TEST_ASSERT*` macros already append a newline when they print. The trailing "\n" produces an extra blank line on failure.
Review-Result: CLEAN
More information about the test-report
mailing list