blob: f3cd7ad29071c2cd3f2c495cbaeb14ab370607df [file] [log] [blame]
From 1314f6c587d866eee02e59c42b31a66c43317d75 Mon Sep 17 00:00:00 2001
From: tannerlove <tannerlove@google.com>
Date: Tue, 9 Jun 2020 17:21:32 -0400
Subject: [PATCH] selftests/net: in rxtimestamp getopt_long needs terminating
null entry
commit 865a6cbb2288f8af7f9dc3b153c61b7014fdcf1e upstream.
getopt_long requires the last element to be filled with zeros.
Otherwise, passing an unrecognized option can cause a segfault.
Fixes: 16e781224198 ("selftests/net: Add a test to validate behavior of rx timestamps")
Signed-off-by: Tanner Love <tannerlove@google.com>
Acked-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
diff --git a/tools/testing/selftests/networking/timestamping/rxtimestamp.c b/tools/testing/selftests/networking/timestamping/rxtimestamp.c
index 6dee9e636a95..422e7761254d 100644
--- a/tools/testing/selftests/networking/timestamping/rxtimestamp.c
+++ b/tools/testing/selftests/networking/timestamping/rxtimestamp.c
@@ -115,6 +115,7 @@ static struct option long_options[] = {
{ "tcp", no_argument, 0, 't' },
{ "udp", no_argument, 0, 'u' },
{ "ip", no_argument, 0, 'i' },
+ { NULL, 0, NULL, 0 },
};
static int next_port = 19999;
--
2.27.0