copy_ns_id_req() rejects a non-zero reserved field. Extend the error case test to cover @spare2 as well as @spare. Signed-off-by: Nikolai Dokutovich --- tools/testing/selftests/namespaces/listns_test.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tools/testing/selftests/namespaces/listns_test.c b/tools/testing/selftests/namespaces/listns_test.c index 538d60f908b4..c52b02bd416a 100644 --- a/tools/testing/selftests/namespaces/listns_test.c +++ b/tools/testing/selftests/namespaces/listns_test.c @@ -667,6 +667,17 @@ TEST(listns_error_cases) } req.spare = 0; + /* Test with invalid spare2 field */ + req.spare2 = 1; + ret = sys_listns(&req, ns_ids, ARRAY_SIZE(ns_ids), 0); + if (errno == ENOSYS) { + /* listns() not supported, skip this check */ + } else { + ASSERT_LT(ret, 0); + ASSERT_EQ(errno, EINVAL); + } + req.spare2 = 0; + /* Test with huge nr_ns_ids */ ret = sys_listns(&req, ns_ids, 2000000, 0); if (errno == ENOSYS) { -- 2.43.0