Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/amd/display: Check correct bounds for stream encoder instances for DCN303

[Why & How]
eng_id for DCN303 cannot be more than 1, since we have only two
instances of stream encoders.

Check the correct boundary condition for engine ID for DCN303 prevent
the potential out of bounds access.

Fixes: cd6d421e3d1a ("drm/amd/display: Initial DC support for Beige Goby")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Cc: stable@vger.kernel.org
Reviewed-by: Chris Park <Chris.Park@amd.com>
Reviewed-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Acked-by: Tom Chung <chiahsuan.chung@amd.com>
Signed-off-by: Aurabindo Pillai <aurabindo.pillai@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Aurabindo Pillai and committed by
Alex Deucher
89b00822 6396679a

+1 -1
+1 -1
drivers/gpu/drm/amd/display/dc/dcn303/dcn303_resource.c
··· 372 372 int afmt_inst; 373 373 374 374 /* Mapping of VPG, AFMT, DME register blocks to DIO block instance */ 375 - if (eng_id <= ENGINE_ID_DIGE) { 375 + if (eng_id <= ENGINE_ID_DIGB) { 376 376 vpg_inst = eng_id; 377 377 afmt_inst = eng_id; 378 378 } else