Thread (19 messages) 19 messages, 2 authors, 2026-08-24

Re: [PATCH v2 05/13] drm/panic: Pass colors to draw_panic_dispatch()

From: sashiko-bot@kernel.org
Date: 2026-08-24 13:13:54
Also in: dri-devel, imx, intel-gfx, intel-xe

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Using KUNIT_ASSERT_EQ with unmanaged resources causes kernel memory leaks on test failure.
--
--- Patch [5]: [PATCH v2 05/13] drm/panic: Pass colors to draw_panic_dispatch() ---
commit dfb1a50d1181cba2ccd93fe314ac428958a579a7
Author: Thomas Zimmermann [off-list ref]

drm/panic: Pass colors to draw_panic_dispatch()

This commit sets the panic-screen colors in a central location and passes
them to the individual drawing functions. In the test cases, it hardcodes
these colors to remove test dependencies on the exact config values.
quoted hunk ↗ jump to hunk
diff --git a/drivers/gpu/drm/tests/drm_panic_test.c b/drivers/gpu/drm/tests/drm_panic_test.c
index fdd77b0cc54c9..969a096ec840f 100644
--- a/drivers/gpu/drm/tests/drm_panic_test.c
+++ b/drivers/gpu/drm/tests/drm_panic_test.c
[ ... ]
quoted hunk ↗ jump to hunk
@@ -48,10 +41,27 @@ struct drm_test_mode {
 	.width = w, \
 	.height = h, \
 	.format = f, \
-	.draw_screen = draw_panic_screen_##name, \
+	.draw_screen = draw_panic_screen_ ## name ## _default, \
[Severity: Medium]
When params->draw_screen(sb) fails, does this cause the test to leak fb?

In drm_test_panic_screen_user_map(), the KUNIT_ASSERT_EQ() macro aborts the
test before vfree(fb) can execute:

drivers/gpu/drm/tests/drm_panic_test.c:drm_test_panic_screen_user_map() {
    ...
	fb = vmalloc(fb_size);
    ...
	ret = params->draw_screen(sb);
	KUNIT_ASSERT_EQ(test, ret, 0);
    ...
	vfree(fb);
}

Similarly, does drm_test_panic_screen_user_page() leak the allocated pages
when the test fails? An abort here skips the free_pages cleanup block:

drivers/gpu/drm/tests/drm_panic_test.c:drm_test_panic_screen_user_page() {
    ...
	ret = params->draw_screen(sb);
	KUNIT_ASSERT_EQ(test, ret, 0);
    ...
free_pages:
	for (p = 0; p < npages; p++)
		__free_page(pages[p]);
	kfree(pages);
}
 	.fname = #name, \
 	}, \
-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260824125201.218863-1-tzimmermann@suse.de?part=5
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help