Skip to content

Commit

Permalink
drm/amd/display: fix dereference before NULL check
Browse files Browse the repository at this point in the history
The "plane_state" pointer was access before checking if it was NULL.

Avoid a possible NULL pointer dereference by accessing the plane
address after the check.

Addresses-Coverity-ID: 1493892 ("Dereference before null check")
Fixes: 3f68c01 ("drm/amd/display: add cyan_skillfish display support")
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
  • Loading branch information
José Expósito authored and Alex Deucher committed Dec 30, 2021
1 parent 6dc8265 commit f28cad8
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/gpu/drm/amd/display/dc/dcn201/dcn201_hwseq.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,12 @@ void dcn201_update_plane_addr(const struct dc *dc, struct pipe_ctx *pipe_ctx)
PHYSICAL_ADDRESS_LOC addr;
struct dc_plane_state *plane_state = pipe_ctx->plane_state;
struct dce_hwseq *hws = dc->hwseq;
struct dc_plane_address uma = plane_state->address;
struct dc_plane_address uma;

if (plane_state == NULL)
return;

uma = plane_state->address;
addr_patched = patch_address_for_sbs_tb_stereo(pipe_ctx, &addr);

plane_address_in_gpu_space_to_uma(hws, &uma);
Expand Down

0 comments on commit f28cad8

Please sign in to comment.