summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorPeter Oskolkov <posk@google.com>2018-12-20 16:41:52 -0800
committerDavid S. Miller <davem@davemloft.net>2018-12-20 19:26:52 -0800
commitfa2323325e8b0c61ded1e3d2c6f12f3aa43c4e30 (patch)
treef7cb8e16f2b92c1a4ff434f72ff3c95519205813 /tools
parenta02e8964eaf9271a8a5fcc0c55bd13f933bafc56 (diff)
selftests: net: reuseport_addr_any: silence clang warning
Clang does not recognize that calls to error() terminate execution and complains about uninitialized variable use that happens after calls to error(). This noop patchset fixes this. Signed-off-by: Peter Oskolkov <posk@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'tools')
-rw-r--r--tools/testing/selftests/net/reuseport_addr_any.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/tools/testing/selftests/net/reuseport_addr_any.c b/tools/testing/selftests/net/reuseport_addr_any.c
index 6f54d425dba9..c6233935fed1 100644
--- a/tools/testing/selftests/net/reuseport_addr_any.c
+++ b/tools/testing/selftests/net/reuseport_addr_any.c
@@ -60,6 +60,11 @@ static void build_rcv_fd(int family, int proto, int *rcv_fds, int count,
break;
default:
error(1, 0, "Unsupported family %d", family);
+ /* clang does not recognize error() above as terminating
+ * the program, so it complains that saddr, sz are
+ * not initialized when this code path is taken. Silence it.
+ */
+ return;
}
for (i = 0; i < count; ++i) {
@@ -128,6 +133,11 @@ static int connect_and_send(int family, int proto)
break;
default:
error(1, 0, "Unsupported family %d", family);
+ /* clang does not recognize error() above as terminating
+ * the program, so it complains that saddr, daddr, sz are
+ * not initialized when this code path is taken. Silence it.
+ */
+ return -1;
}
fd = socket(family, proto, 0);