From: jsg Date: Thu, 30 Nov 2023 02:38:28 +0000 (+0000) Subject: drm/amd/display: Avoid NULL dereference of timing generator X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=d0bf354fe14a86976c864788bbf99a71ab91400a;p=openbsd drm/amd/display: Avoid NULL dereference of timing generator From Wayne Lin 8a06894666e0b462c9316b26ab615cefdd0d676c in linux-6.1.y/6.1.64 b1904ed480cee3f9f4036ea0e36d139cb5fee2d6 in mainline linux --- diff --git a/sys/dev/pci/drm/amd/display/dc/core/dc_stream.c b/sys/dev/pci/drm/amd/display/dc/core/dc_stream.c index 38d71b5c1f2..556c57c390f 100644 --- a/sys/dev/pci/drm/amd/display/dc/core/dc_stream.c +++ b/sys/dev/pci/drm/amd/display/dc/core/dc_stream.c @@ -567,7 +567,7 @@ uint32_t dc_stream_get_vblank_counter(const struct dc_stream_state *stream) for (i = 0; i < MAX_PIPES; i++) { struct timing_generator *tg = res_ctx->pipe_ctx[i].stream_res.tg; - if (res_ctx->pipe_ctx[i].stream != stream) + if (res_ctx->pipe_ctx[i].stream != stream || !tg) continue; return tg->funcs->get_frame_count(tg); @@ -626,7 +626,7 @@ bool dc_stream_get_scanoutpos(const struct dc_stream_state *stream, for (i = 0; i < MAX_PIPES; i++) { struct timing_generator *tg = res_ctx->pipe_ctx[i].stream_res.tg; - if (res_ctx->pipe_ctx[i].stream != stream) + if (res_ctx->pipe_ctx[i].stream != stream || !tg) continue; tg->funcs->get_scanoutpos(tg,