]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
drm/amd/display: added NULL check at start of dc_validate_stream
authorwinstang <winstang@amd.com>
Mon, 27 May 2024 12:51:19 +0000 (08:51 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 14 Jun 2024 20:17:15 +0000 (16:17 -0400)
[Why]
prevent invalid memory access

[How]
check if dc and stream are NULL

Co-authored-by: winstang <winstang@amd.com>
Reviewed-by: Alvin Lee <alvin.lee2@amd.com>
Acked-by: Zaeem Mohamed <zaeem.mohamed@amd.com>
Signed-off-by: winstang <winstang@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/core/dc_resource.c

index 45a719fe884ea531711419c99208e183dd1b1400..6d4d4c95243fd2ba41fbfe3ce24568b10f1f1abf 100644 (file)
@@ -4754,6 +4754,9 @@ void resource_build_bit_depth_reduction_params(struct dc_stream_state *stream,
 
 enum dc_status dc_validate_stream(struct dc *dc, struct dc_stream_state *stream)
 {
+       if (dc == NULL || stream == NULL)
+               return DC_ERROR_UNEXPECTED;
+
        struct dc_link *link = stream->link;
        struct timing_generator *tg = dc->res_pool->timing_generators[0];
        enum dc_status res = DC_OK;