[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230828150858.393570-4-revest@chromium.org>
Date: Mon, 28 Aug 2023 17:08:55 +0200
From: Florent Revest <revest@...omium.org>
To: linux-kernel@...r.kernel.org, linux-mm@...ck.org
Cc: akpm@...ux-foundation.org, catalin.marinas@....com,
anshuman.khandual@....com, joey.gouly@....com, mhocko@...e.com,
keescook@...omium.org, david@...hat.com, peterx@...hat.com,
izbyshev@...ras.ru, broonie@...nel.org, szabolcs.nagy@....com,
kpsingh@...nel.org, gthelen@...gle.com, toiwoton@...il.com,
ayush.jain3@....com, Florent Revest <revest@...omium.org>
Subject: [PATCH v4 3/6] kselftest: vm: Check errnos in mdwe_test
Invalid prctls return a negative code and set errno. It's good practice
to check that errno is set as expected.
Signed-off-by: Florent Revest <revest@...omium.org>
---
tools/testing/selftests/mm/mdwe_test.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/tools/testing/selftests/mm/mdwe_test.c b/tools/testing/selftests/mm/mdwe_test.c
index 91aa9c3099e7..1b84cf8e1bbe 100644
--- a/tools/testing/selftests/mm/mdwe_test.c
+++ b/tools/testing/selftests/mm/mdwe_test.c
@@ -23,14 +23,22 @@
TEST(prctl_flags)
{
EXPECT_LT(prctl(PR_SET_MDWE, 7L, 0L, 0L, 0L), 0);
+ EXPECT_EQ(errno, EINVAL);
EXPECT_LT(prctl(PR_SET_MDWE, 0L, 7L, 0L, 0L), 0);
+ EXPECT_EQ(errno, EINVAL);
EXPECT_LT(prctl(PR_SET_MDWE, 0L, 0L, 7L, 0L), 0);
+ EXPECT_EQ(errno, EINVAL);
EXPECT_LT(prctl(PR_SET_MDWE, 0L, 0L, 0L, 7L), 0);
+ EXPECT_EQ(errno, EINVAL);
EXPECT_LT(prctl(PR_GET_MDWE, 7L, 0L, 0L, 0L), 0);
+ EXPECT_EQ(errno, EINVAL);
EXPECT_LT(prctl(PR_GET_MDWE, 0L, 7L, 0L, 0L), 0);
+ EXPECT_EQ(errno, EINVAL);
EXPECT_LT(prctl(PR_GET_MDWE, 0L, 0L, 7L, 0L), 0);
+ EXPECT_EQ(errno, EINVAL);
EXPECT_LT(prctl(PR_GET_MDWE, 0L, 0L, 0L, 7L), 0);
+ EXPECT_EQ(errno, EINVAL);
}
FIXTURE(mdwe)
--
2.42.0.rc2.253.gd59a3bf2b4-goog
Powered by blists - more mailing lists