Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] drm/tests: ERR_PTR dereference after
  drm_atomic_test_init_drm_components()
- [Low] drm/tests: commit subject uses stale drm_atomic_state_test
  prefix
--

commit 764d6a07d978e1acc8e6005af10238d412ddeb08
Author: Maxime Ripard <[email protected]>

drm/tests: drm_atomic_state_test: Switch to drm_mode_config_create_initial_state

This commit switches drm_atomic_test_init_drm_components() from
drm_mode_config_reset() to drm_mode_config_create_initial_state() for
initial KMS state creation.

> drm/tests: drm_atomic_state_test: Switch to 
> drm_mode_config_create_initial_state

[Severity: Low]
This isn't a bug, but 5164f7e7ff8e ("drm: Rename struct drm_atomic_state
to drm_atomic_commit") renamed this test file to
drm_atomic_commit_test.c, so the subject prefix still refers to the old
name.

> diff --git a/drivers/gpu/drm/tests/drm_atomic_commit_test.c 
> b/drivers/gpu/drm/tests/drm_atomic_commit_test.c
> index 6ccb001f6264b..97f60ce68b3e4 100644
> --- a/drivers/gpu/drm/tests/drm_atomic_commit_test.c
> +++ b/drivers/gpu/drm/tests/drm_atomic_commit_test.c
> @@ -134,7 +134,9 @@ drm_atomic_test_init_drm_components(struct kunit *test, 
> bool has_connectors)
>       }
>  
>  done:
> -     drm_mode_config_reset(drm);
> +     ret = drm_mode_config_create_initial_state(drm);
> +     if (ret)
> +             return ERR_PTR(ret);
>  
>       return priv;
>  }

[Severity: Medium]
Can returning ERR_PTR(ret) here lead to an error pointer dereference in
the callers?

Every earlier step in drm_atomic_test_init_drm_components() aborts via
KUNIT_ASSERT_*, and the callers only check KUNIT_ASSERT_NOT_NULL(test,
priv) before passing priv to set_up_atomic_state(), which dereferences
priv->crtc:

drivers/gpu/drm/tests/drm_atomic_commit_test.c:drm_test_check_connector_changed_modeset()
 {
        ...
        priv = drm_atomic_test_init_drm_components(test, true);
        KUNIT_ASSERT_NOT_NULL(test, priv);

        /* First, do a modeset to set the connector */
        ret = set_up_atomic_state(test, priv, &priv->connectors[0], &ctx);
        ...
}

Using KUNIT_ASSERT_EQ(test, ret, 0) here matches the rest of the helper,
and it looks like that change was accidentally squashed into the
following commit "drm/tests: drm_atomic_test: Switch to
drm_mode_config_create_initial_state".

-- 
Sashiko AI review ยท 
https://sashiko.dev/#/patchset/[email protected]?part=38

Reply via email to