Skip to contentSkip to conversation

futex_waitv01: Add test verifies EINVAL for invalid nr_futexes

PATCH zhaogongyi via ltp 1 participant 1 message Apr 8, 2022

lore
Share & tools
lore
#0 lore raw

Hi,

Thanks for your review!

It seems better that add a check of lower bound, I have resubmit the patch, please see: https://patchwork.ozlabs.org/project/ltp/patch/[email protected]/

Best Wishes

GONGYI

Hi Zhao,

Thanks for the patch. Please consider the following review. On 4/8/22 09:54, Andrea Cervesato via ltp wrote:

Hi!

Thanks for the patch.
On 4/7/22 09:57, Zhao Gongyi via ltp wrote:

Add test verifies EINVAL for invalid nr_futexes according to

https://www.kernel.org/doc/html/latest/userspace-api/futex2.html.

---

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

index 601fee8df..525420647 100644

--- a/testcases/kernel/syscalls/futex/futex_waitv01.c

+++ b/testcases/kernel/syscalls/futex/futex_waitv01.c

@@ -98,6 +98,17 @@ 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_futex is [1, 128] */

+ TST_EXP_FAIL(futex_waitv(waitv, 129, 0, &to, CLOCK_REALTIME), EINVAL,

+ "futex_waitv invalid nr_futex");

Can you please check also lower bound? So we'll check for 0 as well.

TST_EXP_FAIL(futex_waitv(waitv, 0, 0, &to, CLOCK_REALTIME), EINVAL,

             "futex_waitv invalid nr_futex");

+}

+

static void run(void)

{

  test_invalid_flags();

@@ -105,6 +116,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

Otherwise LGTM.

Andrea Cervesato

Signature · 2 lines
-- 
Mailing list info: https://lists.linux.it/listinfo/ltp