Commit 1791bd09 authored by Srinivasan Shanmugam's avatar Srinivasan Shanmugam Committed by Alex Deucher
Browse files

drm/amd/display: Add hpd_source index out-of-bounds check for dcn3x link encoder creation



This patch adds a boundary check for the hpd_source index during the
link encoder creation process for dcn3x IP's. The check ensures that the
index is within the valid range of the link_enc_hpd_regs array to
prevent out-of-bounds access.

Cc: Tom Chung <chiahsuan.chung@amd.com>
Cc: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Cc: Roman Li <roman.li@amd.com>
Cc: Alex Hung <alex.hung@amd.com>
Cc: Aurabindo Pillai <aurabindo.pillai@amd.com>
Cc: Harry Wentland <harry.wentland@amd.com>
Cc: Hamza Mahfooz <hamza.mahfooz@amd.com>
Signed-off-by: default avatarSrinivasan Shanmugam <srinivasan.shanmugam@amd.com>
Reviewed-by: default avatarRoman Li <roman.li@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 144df260
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -927,7 +927,7 @@ static struct link_encoder *dcn30_link_encoder_create(
	struct dcn20_link_encoder *enc20 =
		kzalloc(sizeof(struct dcn20_link_encoder), GFP_KERNEL);

	if (!enc20)
	if (!enc20 || enc_init_data->hpd_source >= ARRAY_SIZE(link_enc_hpd_regs))
		return NULL;

	dcn30_link_encoder_construct(enc20,
+1 −1
Original line number Diff line number Diff line
@@ -883,7 +883,7 @@ static struct link_encoder *dcn301_link_encoder_create(
	struct dcn20_link_encoder *enc20 =
		kzalloc(sizeof(struct dcn20_link_encoder), GFP_KERNEL);

	if (!enc20)
	if (!enc20 || enc_init_data->hpd_source >= ARRAY_SIZE(link_enc_hpd_regs))
		return NULL;

	dcn301_link_encoder_construct(enc20,
+1 −1
Original line number Diff line number Diff line
@@ -893,7 +893,7 @@ static struct link_encoder *dcn302_link_encoder_create(
{
	struct dcn20_link_encoder *enc20 = kzalloc(sizeof(struct dcn20_link_encoder), GFP_KERNEL);

	if (!enc20)
	if (!enc20 || enc_init_data->hpd_source >= ARRAY_SIZE(link_enc_hpd_regs))
		return NULL;

	dcn30_link_encoder_construct(enc20, enc_init_data, &link_enc_feature,
+1 −1
Original line number Diff line number Diff line
@@ -839,7 +839,7 @@ static struct link_encoder *dcn303_link_encoder_create(
{
	struct dcn20_link_encoder *enc20 = kzalloc(sizeof(struct dcn20_link_encoder), GFP_KERNEL);

	if (!enc20)
	if (!enc20 || enc_init_data->hpd_source >= ARRAY_SIZE(link_enc_hpd_regs))
		return NULL;

	dcn30_link_encoder_construct(enc20, enc_init_data, &link_enc_feature,
+1 −1
Original line number Diff line number Diff line
@@ -1093,7 +1093,7 @@ static struct link_encoder *dcn31_link_encoder_create(
	struct dcn20_link_encoder *enc20 =
		kzalloc(sizeof(struct dcn20_link_encoder), GFP_KERNEL);

	if (!enc20)
	if (!enc20 || enc_init_data->hpd_source >= ARRAY_SIZE(link_enc_hpd_regs))
		return NULL;

	dcn31_link_encoder_construct(enc20,
Loading