[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231110200830.1832556-3-davidgow@google.com>
Date: Sat, 11 Nov 2023 04:08:28 +0800
From: David Gow <davidgow@...gle.com>
To: Nathan Chancellor <nathan@...nel.org>, Kees Cook <keescook@...omium.org>,
Brendan Higgins <brendan.higgins@...ux.dev>, Rae Moar <rmoar@...gle.com>, dlatypov@...gle.com,
Maxime Ripard <mripard@...nel.org>, Arthur Grillo <arthurgrillo@...eup.net>,
Shuah Khan <skhan@...uxfoundation.org>
Cc: David Gow <davidgow@...gle.com>,
"MaĆra Canal" <mairacanal@...eup.net>, Sami Tolvanen <samitolvanen@...gle.com>,
kunit-dev@...glegroups.com, llvm@...ts.linux.dev,
linux-hardening@...r.kernel.org, linux-kselftest@...r.kernel.org,
Benjamin Berg <benjamin.berg@...el.com>, Richard Fitzgerald <rf@...nsource.cirrus.com>,
linux-kernel@...r.kernel.org,
Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>, Thomas Zimmermann <tzimmermann@...e.de>,
Emma Anholt <emma@...olt.net>, David Airlie <airlied@...il.com>, Daniel Vetter <daniel@...ll.ch>,
dri-devel@...ts.freedesktop.org
Subject: [PATCH 3/3] drm/vc4: tests: Use KUNIT_DEFINE_ACTION_WRAPPER
In order to pass functions to kunit_add_action(), they need to be of the
kunit_action_t type. While casting the function pointer can work, it
will break control-flow integrity.
vc4_mock already defines such a wrapper for drm_dev_unregister(), but it
involves less boilerplate to use the new macro, so replace the manual
implementation.
Signed-off-by: David Gow <davidgow@...gle.com>
---
This patch should be a no-op, just moving to use a standard macro to
implement these wrappers rather than hand-coding them.
Let me know if you'd prefer to take these in separately via the drm
trees, or if you're okay with having this whole series go via
kselftest/kunit.
Cheers,
-- David
---
drivers/gpu/drm/vc4/tests/vc4_mock.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/vc4/tests/vc4_mock.c b/drivers/gpu/drm/vc4/tests/vc4_mock.c
index 63ca46f4cb35..becb3dbaa548 100644
--- a/drivers/gpu/drm/vc4/tests/vc4_mock.c
+++ b/drivers/gpu/drm/vc4/tests/vc4_mock.c
@@ -153,12 +153,9 @@ static int __build_mock(struct kunit *test, struct drm_device *drm,
return 0;
}
-static void kunit_action_drm_dev_unregister(void *ptr)
-{
- struct drm_device *drm = ptr;
-
- drm_dev_unregister(drm);
-}
+KUNIT_DEFINE_ACTION_WRAPPER(kunit_action_drm_dev_unregister,
+ drm_dev_unregister,
+ struct drm_device *);
static struct vc4_dev *__mock_device(struct kunit *test, bool is_vc5)
{
--
2.42.0.869.gea05f2083d-goog
Powered by blists - more mailing lists