Skip to content

Commit 3bb9b1f

Browse files
srishanmalexdeucher
authored andcommitted
drm/amd/display: Fix late derefrence 'dsc' check in 'link_set_dsc_pps_packet()'
In link_set_dsc_pps_packet(), 'struct display_stream_compressor *dsc' was dereferenced in a DC_LOGGER_INIT(dsc->ctx->logger); before the 'dsc' NULL pointer check. Fixes the below: drivers/gpu/drm/amd/amdgpu/../display/dc/link/link_dpms.c:905 link_set_dsc_pps_packet() warn: variable dereferenced before check 'dsc' (see line 903) Cc: stable@vger.kernel.org Cc: Aurabindo Pillai <aurabindo.pillai@amd.com> Cc: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com> Cc: Hamza Mahfooz <hamza.mahfooz@amd.com> Cc: Wenjing Liu <wenjing.liu@amd.com> Cc: Qingqing Zhuo <qingqing.zhuo@amd.com> Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com> Reviewed-by: Aurabindo Pillai <aurabindo.pillai@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent d7643fe commit 3bb9b1f

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

drivers/gpu/drm/amd/display/dc/link/link_dpms.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -900,11 +900,15 @@ bool link_set_dsc_pps_packet(struct pipe_ctx *pipe_ctx, bool enable, bool immedi
900900
{
901901
struct display_stream_compressor *dsc = pipe_ctx->stream_res.dsc;
902902
struct dc_stream_state *stream = pipe_ctx->stream;
903-
DC_LOGGER_INIT(dsc->ctx->logger);
904903

905-
if (!pipe_ctx->stream->timing.flags.DSC || !dsc)
904+
if (!pipe_ctx->stream->timing.flags.DSC)
906905
return false;
907906

907+
if (!dsc)
908+
return false;
909+
910+
DC_LOGGER_INIT(dsc->ctx->logger);
911+
908912
if (enable) {
909913
struct dsc_config dsc_cfg;
910914
uint8_t dsc_packed_pps[128];

0 commit comments

Comments
 (0)