<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body>
    <p><font size="4">Hi!</font></p>
    <p><font size="4">It looks good, +1<br>
      </font></p>
    <p><font size="4">Reviewed-by: Andrea Cervesato
        <a class="moz-txt-link-rfc2396E" href="mailto:andrea.cervesato@suse.de"><andrea.cervesato@suse.de></a></font></p>
    <div class="moz-cite-prefix"><br>
    </div>
    <div class="moz-cite-prefix">On 4/8/22 11:17, Zhao Gongyi via ltp
      wrote:<br>
    </div>
    <blockquote type="cite" cite="mid:20220408091733.15323-1-zhaogongyi@huawei.com">
      <pre class="moz-quote-pre" wrap="">Add test verifies EINVAL for invalid nr_futexes according to
<a class="moz-txt-link-freetext" href="https://www.kernel.org/doc/html/latest/userspace-api/futex2.html">https://www.kernel.org/doc/html/latest/userspace-api/futex2.html</a>.

Signed-off-by: Zhao Gongyi <a class="moz-txt-link-rfc2396E" href="mailto:zhaogongyi@huawei.com"><zhaogongyi@huawei.com></a>
---
v1->v2: Check also lower bound that suggested by Andrea Cervesato

 testcases/kernel/syscalls/futex/futex_waitv01.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/testcases/kernel/syscalls/futex/futex_waitv01.c b/testcases/kernel/syscalls/futex/futex_waitv01.c
index 601fee8df..721852750 100644
--- a/testcases/kernel/syscalls/futex/futex_waitv01.c
+++ b/testcases/kernel/syscalls/futex/futex_waitv01.c
@@ -98,6 +98,19 @@ static void test_invalid_clockid(void)
                     "futex_waitv invalid clockid");
 }

+static void test_invalid_nr_futex(void)
+{
+       struct timespec to;
+       init_waitv();
+       init_timeout(&to);
+
+       /* Valid nr_futexes is [1, 128] */
+       TST_EXP_FAIL(futex_waitv(waitv, 129, 0, &to, CLOCK_REALTIME), EINVAL,
+                    "futex_waitv invalid nr_futexes");
+       TST_EXP_FAIL(futex_waitv(waitv, 0, 0, &to, CLOCK_REALTIME), EINVAL,
+                    "futex_waitv invalid nr_futexes");
+}
+
 static void run(void)
 {
        test_invalid_flags();
@@ -105,6 +118,7 @@ static void run(void)
        test_null_address();
        test_null_waiters();
        test_invalid_clockid();
+       test_invalid_nr_futex();
 }

 static struct tst_test test = {
--
2.17.1


</pre>
    </blockquote>
  </body>
</html>