diff mbox series

[iproute2,2/5] fix fallthrough warnings

Message ID 20230628233813.6564-3-stephen@networkplumber.org (mailing list archive)
State Accepted
Commit 2b41725d2a46c22ee9c55bc1725e926801f20d57
Delegated to: David Ahern
Headers show
Series Warning fixes | expand

Checks

Context Check Description
netdev/tree_selection success Not a local patch

Commit Message

Stephen Hemminger June 28, 2023, 11:38 p.m. UTC
In lib/utils.c comment for fallthrough was in wrong place
and one was missing in xfrm_state.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 ip/xfrm_state.c | 1 +
 lib/utils.c     | 3 +--
 2 files changed, 2 insertions(+), 2 deletions(-)

Comments

Petr Machata June 29, 2023, 1:54 p.m. UTC | #1
Stephen Hemminger <stephen@networkplumber.org> writes:

> In lib/utils.c comment for fallthrough was in wrong place
> and one was missing in xfrm_state.
>
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>

That xfrm code is a bit too sprawling to understand what's going on, but
it's hard to imagine what else than an intentional fall-through would
make sense in that context. With that:

Reviewed-by: Petr Machata <me@pmachata.org>
diff mbox series

Patch

diff --git a/ip/xfrm_state.c b/ip/xfrm_state.c
index a7b3d0e14156..9be65b2f8461 100644
--- a/ip/xfrm_state.c
+++ b/ip/xfrm_state.c
@@ -660,6 +660,7 @@  static int xfrm_state_modify(int cmd, unsigned int flags, int argc, char **argv)
 		case XFRM_MODE_BEET:
 			if (req.xsinfo.id.proto == IPPROTO_ESP)
 				break;
+			/* fallthrough */
 		default:
 			fprintf(stderr, "MODE value is invalid with XFRM-PROTO value \"%s\"\n",
 				strxf_xfrmproto(req.xsinfo.id.proto));
diff --git a/lib/utils.c b/lib/utils.c
index 01f3a5f7e4ea..b1f273054906 100644
--- a/lib/utils.c
+++ b/lib/utils.c
@@ -985,9 +985,8 @@  const char *rt_addr_n2a_r(int af, int len,
 			return inet_ntop(AF_INET6, &sa->sin6.sin6_addr,
 					 buf, buflen);
 		}
-
-		/* fallthrough */
 	}
+		/* fallthrough */
 	default:
 		return "???";
 	}