Trinity tests could use a smaller "PF_MAX", TRINITY_PF_MAX, than the real limit for supporting older kernels. However the random generated index is rounded of with PF_MAX, leading to use an index potentially bigger than the members in net_protocols array, causing test crashes. Fix this by limiting the index to the real size of the array. Signed-off-by: Suzuki K Poulose <suzuki.poulose@xxxxxxx> --- syscalls/setsockopt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syscalls/setsockopt.c b/syscalls/setsockopt.c index 3f38a61..1174e3b 100644 --- a/syscalls/setsockopt.c +++ b/syscalls/setsockopt.c @@ -90,7 +90,7 @@ static void do_random_sso(struct sockopt *so, struct socket_triplet *triplet) retry: switch (rnd() % 4) { case 0: /* do a random protocol, even if it doesn't match this socket. */ - i = rnd() % PF_MAX; + i = rnd() % TRINITY_PF_MAX; proto = net_protocols[i].proto; if (proto != NULL) { if (proto->setsockopt != NULL) { -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe trinity" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html