public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] kunit: print a message before triggering a NULL dereference
@ 2025-09-05 10:34 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2025-09-05 10:34 UTC (permalink / raw)
  To: Mickaël Salaün
  Cc: Brendan Higgins, David Gow, Rae Moar, linux-kselftest, kunit-dev,
	linux-kernel, kernel-janitors

Print a message so that people reading dmesg know that these NULL
dereferences are not a bug, but instead a deliberate part of
the testing.

Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
 lib/kunit/kunit-test.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/kunit/kunit-test.c b/lib/kunit/kunit-test.c
index 8c01eabd4eaf..a8b6e16f4465 100644
--- a/lib/kunit/kunit-test.c
+++ b/lib/kunit/kunit-test.c
@@ -119,6 +119,8 @@ static void kunit_test_null_dereference(void *data)
 	struct kunit *test = data;
 	int *null = NULL;
 
+	pr_info("Triggering deliberate NULL derefence.\n");
+
 	*null = 0;
 
 	KUNIT_FAIL(test, "This line should never be reached\n");
-- 
2.47.2


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2025-09-05 10:34 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-05 10:34 [PATCH] kunit: print a message before triggering a NULL dereference Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox