The 'top_pipe_to_program pointer' can be NULL and it is checked 
at the first dereference, but not at the second. 

Add a check before using it.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Signed-off-by: Igor Artemiev <igor.a.artem...@mcst.ru>
---
 drivers/gpu/drm/amd/display/dc/core/dc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c 
b/drivers/gpu/drm/amd/display/dc/core/dc.c
index 3a9077b60029..154ad23ff931 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc.c
@@ -3824,7 +3824,8 @@ static void commit_planes_for_stream(struct dc *dc,
        }
 
        if ((update_type != UPDATE_TYPE_FAST) && 
stream->update_flags.bits.dsc_changed)
-               if 
(top_pipe_to_program->stream_res.tg->funcs->lock_doublebuffer_enable) {
+               if (top_pipe_to_program &&
+                               
top_pipe_to_program->stream_res.tg->funcs->lock_doublebuffer_enable) {
                        
top_pipe_to_program->stream_res.tg->funcs->wait_for_state(
                                top_pipe_to_program->stream_res.tg,
                                CRTC_STATE_VACTIVE);
-- 
2.30.2

Reply via email to