Skip to contentSkip to conversation

selftests/net: in rxtimestamp getopt_long needs terminating null entry

PATCH In review Tanner Love 2 participants 2 messages Jun 9, 2020

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 selftests/net: in rxtimestamp getopt_long needs terminating null entry

From: tannerlove <[email protected]>

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")
---
 tools/testing/selftests/net/rxtimestamp.c | 1 +
 1 file changed, 1 insertion(+)
tools/testing/selftests/net/rxtimestamp.c +1 -0
index 6dee9e636a95..422e7761254d 100644
@@ -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;
Signature · 1 line
2.27.0.278.ge193c7cf3a9-goog
maintainer
#1 lore raw

From: Tanner Love <[email protected]>
Date: Tue, 9 Jun 2020 17:21:32 -0400

Quoted 8 lines

From: tannerlove <[email protected]>

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")

Applied and queued up for -stable, thank you.