diff mbox series

[net] selftests/net: in rxtimestamp getopt_long needs terminating null entry

Message ID 20200609212132.100714-1-tannerlove.kernel@gmail.com
State Accepted
Delegated to: David Miller
Headers show
Series [net] selftests/net: in rxtimestamp getopt_long needs terminating null entry | expand

Commit Message

Tanner Love June 9, 2020, 9:21 p.m. UTC
From: tannerlove <tannerlove@google.com>

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>
---
 tools/testing/selftests/net/rxtimestamp.c | 1 +
 1 file changed, 1 insertion(+)

Comments

David Miller June 9, 2020, 9:32 p.m. UTC | #1
From: Tanner Love <tannerlove.kernel@gmail.com>
Date: Tue,  9 Jun 2020 17:21:32 -0400

> From: tannerlove <tannerlove@google.com>
> 
> 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>

Applied and queued up for -stable, thank you.
diff mbox series

Patch

diff --git a/tools/testing/selftests/net/rxtimestamp.c b/tools/testing/selftests/net/rxtimestamp.c
index 6dee9e636a95..422e7761254d 100644
--- a/tools/testing/selftests/net/rxtimestamp.c
+++ b/tools/testing/selftests/net/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;