netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Oskolkov <posk@google.com>
To: David Miller <davem@davemloft.net>, netdev@vger.kernel.org
Cc: Peter Oskolkov <posk.devel@gmail.com>, Peter Oskolkov <posk@google.com>
Subject: [PATCH net-next v2] selftests: net: reuseport_addr_any: silence clang warning
Date: Thu, 20 Dec 2018 16:33:03 -0800	[thread overview]
Message-ID: <20181221003303.2859-1-posk@google.com> (raw)

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>

---
 tools/testing/selftests/net/reuseport_addr_any.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/tools/testing/selftests/net/reuseport_addr_any.c b/tools/testing/selftests/net/reuseport_addr_any.c
index 6f54d425dba9..1e49cf9acf98 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;
 	}
 
 	fd = socket(family, proto, 0);
-- 
2.20.1.415.g653613c723-goog

                 reply	other threads:[~2018-12-21  0:33 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181221003303.2859-1-posk@google.com \
    --to=posk@google.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=posk.devel@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).