* [PATCH net] selftests/net: rxtimestamp: Fix an off by one
@ 2017-10-05 12:53 Dan Carpenter
2017-10-06 4:29 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2017-10-05 12:53 UTC (permalink / raw)
To: Shuah Khan, Mike Maloney
Cc: Willem de Bruijn, David S. Miller, linux-kselftest, netdev,
kernel-janitors
The > should be >= so that we don't write one element beyond the end of
the array.
Fixes: 16e781224198 ("selftests/net: Add a test to validate behavior of rx timestamps")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/tools/testing/selftests/networking/timestamping/rxtimestamp.c b/tools/testing/selftests/networking/timestamping/rxtimestamp.c
index 00f286661dcd..dd4162fc0419 100644
--- a/tools/testing/selftests/networking/timestamping/rxtimestamp.c
+++ b/tools/testing/selftests/networking/timestamping/rxtimestamp.c
@@ -341,7 +341,7 @@ int main(int argc, char **argv)
return 0;
case 'n':
t = atoi(optarg);
- if (t > ARRAY_SIZE(test_cases))
+ if (t >= ARRAY_SIZE(test_cases))
error(1, 0, "Invalid test case: %d", t);
all_tests = false;
test_cases[t].enabled = true;
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net] selftests/net: rxtimestamp: Fix an off by one
2017-10-05 12:53 [PATCH net] selftests/net: rxtimestamp: Fix an off by one Dan Carpenter
@ 2017-10-06 4:29 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2017-10-06 4:29 UTC (permalink / raw)
To: dan.carpenter
Cc: shuah, maloney, willemb, linux-kselftest, netdev, kernel-janitors
From: Dan Carpenter <dan.carpenter@oracle.com>
Date: Thu, 5 Oct 2017 15:53:47 +0300
> The > should be >= so that we don't write one element beyond the end of
> the array.
>
> Fixes: 16e781224198 ("selftests/net: Add a test to validate behavior of rx timestamps")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Applied.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-10-06 4:29 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-05 12:53 [PATCH net] selftests/net: rxtimestamp: Fix an off by one Dan Carpenter
2017-10-06 4:29 ` David Miller
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).