From 5da984e89011df14fa19d5277ff0eff2dc9459e8 Mon Sep 17 00:00:00 2001 From: Peter Bigot Date: Wed, 23 Dec 2020 06:54:12 -0600 Subject: [PATCH] net: dhcp: fix bounds check in timeout The flag value UINT32_MAX is returned from manage_timers() when a send operation did not succeed. This indicates that the timeout should not be rescheduled, but because it will never replace the starting update value UINT32_MAX-1 the check will never pass, and in cases where it should work will be submitted to run at UINT32_MAX-1 seconds. Fix the upper bound. Signed-off-by: Peter Bigot --- subsys/net/ip/dhcpv4.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/net/ip/dhcpv4.c b/subsys/net/ip/dhcpv4.c index ae96f2c17b7..5dda5c8b43e 100644 --- a/subsys/net/ip/dhcpv4.c +++ b/subsys/net/ip/dhcpv4.c @@ -602,7 +602,7 @@ static uint32_t dhcph4_manage_timers(struct net_if *iface, int64_t timeout) static void dhcpv4_timeout(struct k_work *work) { - uint32_t timeout_update = UINT32_MAX - 1; + uint32_t timeout_update = UINT32_MAX; int64_t timeout = k_uptime_get(); struct net_if_dhcpv4 *current, *next;