Thank you for your contribution! Sashiko AI review found 1 potential issue(s) 
to consider:
- [Medium] NULL pointer dereference in KUnit tests due to uninitialized 
`connector_state->connector` pointer.
--

commit 76d9dc4fc5efbfc79cdb3d3327ee0c10ae387dea
Author: Adrian Betschart <[email protected]>

drm/amd/display: Default HDMI RGB output to limited range on CTA modes

This commit changes the default HDMI RGB output to limited range on CTA
modes by introducing the rgb_output_is_limited_range function. The function
evaluates the broadcast_rgb property and falls back to inspecting the
connector's display_info for HDMI capabilities when set to automatic.

Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/5796

> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_connector.c 
> b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_connector.c
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_connector.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_connector.c

[ ... ]

> @@ -734,6 +734,24 @@ get_aspect_ratio(const struct drm_display_mode *mode_in)
> +static bool rgb_output_is_limited_range(const struct dc_crtc_timing 
> *dc_crtc_timing,
> +                                     const struct drm_connector_state 
> *connector_state)
> +{
> +     switch (connector_state->hdmi.broadcast_rgb) {
> +     case DRM_HDMI_BROADCAST_RGB_FULL:
> +             return false;
> +     case DRM_HDMI_BROADCAST_RGB_LIMITED:
> +             return true;
> +     default:
> +             return connector_state->connector->display_info.is_hdmi &&

[Severity: Medium]
Will this cause a NULL pointer dereference during KUnit test execution?

The rgb_output_is_limited_range function dereferences
connector_state->connector to check display_info.is_hdmi in the default
broadcast RGB case.

Many KUnit tests for amdgpu_dm_get_output_color_space, such as
dm_test_output_color_space_default_rgb_full, allocate a dummy
drm_connector_state without explicitly initializing the connector pointer,
leaving it NULL.

When these tests run, they will hit this path and crash when evaluating
connector_state->connector->display_info.is_hdmi. Could we add a check for
connector_state->connector, or update the KUnit tests to initialize it?

> +                    dc_crtc_timing->vic > 1;
> +     }
> +}

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

Reply via email to