[Public] The series Reviewed-by: Roman Li <roman...@amd.com>
> -----Original Message----- > From: SHANMUGAM, SRINIVASAN <srinivasan.shanmu...@amd.com> > Sent: Thursday, October 17, 2024 2:56 AM > To: Siqueira, Rodrigo <rodrigo.sique...@amd.com>; Pillai, Aurabindo > <aurabindo.pil...@amd.com> > Cc: amd-gfx@lists.freedesktop.org; SHANMUGAM, SRINIVASAN > <srinivasan.shanmu...@amd.com>; Chung, ChiaHsuan (Tom) > <chiahsuan.ch...@amd.com>; Li, Roman <roman...@amd.com>; Hung, Alex > <alex.h...@amd.com>; Wentland, Harry <harry.wentl...@amd.com>; Mahfooz, > Hamza <hamza.mahf...@amd.com> > Subject: [PATCH 3/3] drm/amd/display: Add hpd_source index check for dcn401 > link encoder setup > > This patch adds a boundary check for the hpd_source index during the link > encoder > creation process for all dcn401 ip. 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.ch...@amd.com> > Cc: Rodrigo Siqueira <rodrigo.sique...@amd.com> > Cc: Roman Li <roman...@amd.com> > Cc: Alex Hung <alex.h...@amd.com> > Cc: Aurabindo Pillai <aurabindo.pil...@amd.com> > Cc: Harry Wentland <harry.wentl...@amd.com> > Cc: Hamza Mahfooz <hamza.mahf...@amd.com> > Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmu...@amd.com> > --- > .../gpu/drm/amd/display/dc/resource/dcn401/dcn401_resource.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/amd/display/dc/resource/dcn401/dcn401_resource.c > b/drivers/gpu/drm/amd/display/dc/resource/dcn401/dcn401_resource.c > index 46feff9348d9..b425b34dc7f5 100644 > --- a/drivers/gpu/drm/amd/display/dc/resource/dcn401/dcn401_resource.c > +++ b/drivers/gpu/drm/amd/display/dc/resource/dcn401/dcn401_resource.c > @@ -1032,7 +1032,7 @@ static struct link_encoder > *dcn401_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; > > #undef REG_STRUCT > -- > 2.34.1