All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH 09/11] netconfig: Exit on errors in netconfig_dhcp_event_handler
@ 2022-04-18 21:12 Denis Kenzior
  0 siblings, 0 replies; 2+ messages in thread
From: Denis Kenzior @ 2022-04-18 21:12 UTC (permalink / raw)
  To: ell

[-- Attachment #1: Type: text/plain, Size: 328 bytes --]

Hi Andrew,

On 4/11/22 09:20, Andrew Zaborowski wrote:
> Don't just warn on errors that could cause a crash later in the function
> even though in theory they can't happen.
> ---
>   ell/netconfig.c | 18 ++++++++++++------
>   1 file changed, 12 insertions(+), 6 deletions(-)
> 

Applied, thanks.

Regards,
-Denis

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH 09/11] netconfig: Exit on errors in netconfig_dhcp_event_handler
@ 2022-04-11 14:20 Andrew Zaborowski
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Zaborowski @ 2022-04-11 14:20 UTC (permalink / raw)
  To: ell

[-- Attachment #1: Type: text/plain, Size: 1612 bytes --]

Don't just warn on errors that could cause a crash later in the function
even though in theory they can't happen.
---
 ell/netconfig.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/ell/netconfig.c b/ell/netconfig.c
index 6641398..030b2e1 100644
--- a/ell/netconfig.c
+++ b/ell/netconfig.c
@@ -292,28 +292,34 @@ static void netconfig_dhcp_event_handler(struct l_dhcp_client *client,
 
 	switch (event) {
 	case L_DHCP_CLIENT_EVENT_IP_CHANGED:
-		L_WARN_ON(!nc->v4_configured);
+		if (L_WARN_ON(!nc->v4_configured))
+			break;
+
 		netconfig_remove_dhcp_address_routes(nc);
 		netconfig_add_dhcp_address_routes(nc);
 		netconfig_set_dhcp_lifetimes(nc, false);
 		netconfig_emit_event(nc, AF_INET, L_NETCONFIG_EVENT_UPDATE);
 		break;
 	case L_DHCP_CLIENT_EVENT_LEASE_OBTAINED:
-	{
-		L_WARN_ON(nc->v4_configured);
+		if (L_WARN_ON(nc->v4_configured))
+			break;
+
 		netconfig_add_dhcp_address_routes(nc);
 		netconfig_set_dhcp_lifetimes(nc, false);
 		nc->v4_configured = true;
 		netconfig_emit_event(nc, AF_INET, L_NETCONFIG_EVENT_CONFIGURE);
 		break;
-	}
 	case L_DHCP_CLIENT_EVENT_LEASE_RENEWED:
-		L_WARN_ON(!nc->v4_configured);
+		if (L_WARN_ON(!nc->v4_configured))
+			break;
+
 		netconfig_set_dhcp_lifetimes(nc, true);
 		netconfig_emit_event(nc, AF_INET, L_NETCONFIG_EVENT_UPDATE);
 		break;
 	case L_DHCP_CLIENT_EVENT_LEASE_EXPIRED:
-		L_WARN_ON(!nc->v4_configured);
+		if (L_WARN_ON(!nc->v4_configured))
+			break;
+
 		netconfig_remove_dhcp_address_routes(nc);
 		nc->v4_configured = false;
 
-- 
2.32.0

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-04-18 21:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-18 21:12 [PATCH 09/11] netconfig: Exit on errors in netconfig_dhcp_event_handler Denis Kenzior
  -- strict thread matches above, loose matches on Subject: below --
2022-04-11 14:20 Andrew Zaborowski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.