[lvc-project] [PATCH 6.1] drm/amd/display: Check null pointers before multiple uses
Aleksandr Burakov
a.burakov at rosa.ru
Wed May 14 21:14:42 MSK 2025
From: Alex Hung <alex.hung at amd.com>
commit fdd5ecbbff751c3b9061d8ebb08e5c96119915b4 upstream.
[WHAT & HOW]
Poniters, such as stream_enc and dc->bw_vbios, are null checked previously
in the same function, so Coverity warns "implies that stream_enc and
dc->bw_vbios might be null". They are used multiple times in the
subsequent code and need to be checked.
This fixes 10 FORWARD_NULL issues reported by Coverity.
Reviewed-by: Rodrigo Siqueira <rodrigo.siqueira at amd.com>
Signed-off-by: Jerry Zuo <jerry.zuo at amd.com>
Signed-off-by: Alex Hung <alex.hung at amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler at amd.com>
Signed-off-by: Alex Deucher <alexander.deucher at amd.com>
[ Aleksandr Burakov: Introducing only the NULL check in
dcn32_enable_phantom_plane() resolves the bug while minimizing risk
and preserving stability in the 6.1.y codebase. ]
Signed-off-by: Aleksandr Burakov <a.burakov at rosa.ru>
---
drivers/gpu/drm/amd/display/dc/dcn32/dcn32_resource.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/gpu/drm/amd/display/dc/dcn32/dcn32_resource.c b/drivers/gpu/drm/amd/display/dc/dcn32/dcn32_resource.c
index 1b1534ffee9f..2e95b48439ca 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn32/dcn32_resource.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn32/dcn32_resource.c
@@ -1664,6 +1664,9 @@ static void dcn32_enable_phantom_plane(struct dc *dc,
else
phantom_plane = dc_create_plane_state(dc);
+ if !(phantom_plane)
+ continue;
+
memcpy(&phantom_plane->address, &curr_pipe->plane_state->address, sizeof(phantom_plane->address));
memcpy(&phantom_plane->scaling_quality, &curr_pipe->plane_state->scaling_quality,
sizeof(phantom_plane->scaling_quality));
--
2.40.1
More information about the lvc-project
mailing list