From 5f2e15b7b21b1dccc166e3e99446f3b00caf8fbe Mon Sep 17 00:00:00 2001 From: Jonathan Gray Date: Sun, 10 Nov 2024 23:16:10 +0000 Subject: drm/amd/display: Add null checks for 'stream' and 'plane' before dereferencing From Srinivasan Shanmugam 10c20d79d59cadfe572480d98cec271a89ffb024 in linux-6.6.y/6.6.60 15c2990e0f0108b9c3752d7072a97d45d4283aea in mainline linux --- sys/dev/pci/drm/amd/display/dc/dcn30/dcn30_hwseq.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'sys/dev/pci') diff --git a/sys/dev/pci/drm/amd/display/dc/dcn30/dcn30_hwseq.c b/sys/dev/pci/drm/amd/display/dc/dcn30/dcn30_hwseq.c index d59af329d00..ba4a1e7f196 100644 --- a/sys/dev/pci/drm/amd/display/dc/dcn30/dcn30_hwseq.c +++ b/sys/dev/pci/drm/amd/display/dc/dcn30/dcn30_hwseq.c @@ -735,6 +735,9 @@ bool dcn30_apply_idle_power_optimizations(struct dc *dc, bool enable) stream = dc->current_state->streams[0]; plane = (stream ? dc->current_state->stream_status[0].plane_states[0] : NULL); + if (!stream || !plane) + return false; + if (stream && plane) { cursor_cache_enable = stream->cursor_position.enable && plane->address.grph.cursor_cache_addr.quad_part; -- cgit v1.2.3