[1/5] eal: add missing parameter check to rte_eal_alarm_set on Windows
Checks
Commit Message
Both Linux and FreeBSD, check parameters to rte_eal_alarm_set,
but Windows missed this. And the test was "fixed" instead.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
lib/eal/windows/eal_alarm.c | 7 +++++++
1 file changed, 7 insertions(+)
@@ -92,6 +92,13 @@ rte_eal_alarm_set(uint64_t us, rte_eal_alarm_callback cb_fn, void *cb_arg)
LARGE_INTEGER deadline;
int ret;
+ /* Check parameters, including that us won't cause a uint64_t overflow */
+ if (us < 1 || us > (UINT64_MAX - US_PER_S)) {
+ EAL_LOG(ERR, "Invalid alarm interval");
+ ret = -EINVAL;
+ goto exit;
+ }
+
if (cb_fn == NULL) {
EAL_LOG(ERR, "NULL callback");
ret = -EINVAL;