Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] drm/tests: error pointer dereference on __connector_hdmi_init() failure --
commit f0f9a8e1f22f0d1c095eb10619c56e34cb056f4b Author: Maxime Ripard <[email protected]> drm/tests: drm_hdmi_state_helper_test: Switch to drm_mode_config_create_initial_state This commit replaces the call to drm_mode_config_reset() in __connector_hdmi_init() with drm_mode_config_create_initial_state() to initialize the KMS state for the HDMI connector state helper KUnit tests. > diff --git a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c > b/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c > index 336bb644cb7c9..99a0fa479704d 100644 > --- a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c > +++ b/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c > @@ -297,7 +297,9 @@ __connector_hdmi_init(struct kunit *test, > drm_connector_helper_add(conn, &dummy_connector_helper_funcs); > drm_connector_attach_encoder(conn, enc); > > - drm_mode_config_reset(drm); > + ret = drm_mode_config_create_initial_state(drm); > + if (ret) > + return ERR_PTR(ret); [Severity: Medium] If drm_mode_config_create_initial_state() fails here in __connector_hdmi_init(), won't returning ERR_PTR(ret) cause the callers to dereference an error pointer? All the other initialization checks in __connector_hdmi_init() abort the test immediately via KUNIT_ASSERT_*() macros rather than returning an error pointer: drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c:__connector_hdmi_init() { ... ret = drmm_connector_hdmi_ini2(drm, conn, "Vendor", "Product", &dummy_connector_funcs, hdmi_funcs, DRM_MODE_CONNECTOR_HDMIA, NULL, formats, max_bpc); KUNIT_ASSERT_EQ(test, ret, 0); ... } Because __connector_hdmi_init() previously never returned an ERR_PTR, the test cases calling drm_kunit_helper_connector_hdmi_init() and drm_kunit_helper_connector_hdmi_init_with_edid_funcs() (such as drm_test_check_broadcast_rgb_crtc_mode_changed()) only check for NULL before dereferencing priv: priv = drm_kunit_helper_connector_hdmi_init(test, BIT(DRM_OUTPUT_COLOR_FORMAT_RGB444), 8); KUNIT_ASSERT_NOT_NULL(test, priv); drm = &priv->drm; crtc = priv->crtc; Should __connector_hdmi_init() use KUNIT_ASSERT_EQ(test, ret, 0) instead of returning ERR_PTR(ret)? -- Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=57
