On Mon, Feb 09, 2026 at 11:34:08PM +0000, Li, Roman wrote:
> > diff --git 
> > a/drivers/gpu/drm/amd/display/dc/resource/dcn315/dcn315_resource.c
> > b/drivers/gpu/drm/amd/display/dc/resource/dcn315/dcn315_resource.c
> > index 4e962f522f1b..d8c1f1911c37 100644
> > --- a/drivers/gpu/drm/amd/display/dc/resource/dcn315/dcn315_resource.c
> > +++ b/drivers/gpu/drm/amd/display/dc/resource/dcn315/dcn315_resource.c
> > @@ -1230,12 +1230,12 @@ static struct stream_encoder
> > *dcn315_stream_encoder_create(
> >       /*PHYB is wired off in HW, allow front end to remapping, otherwise 
> > needs
> > more changes*/
> >
> >       /* Mapping of VPG, AFMT, DME register blocks to DIO block instance */
> > -     if (eng_id <= ENGINE_ID_DIGF) {
> > -             vpg_inst = eng_id;
> > -             afmt_inst = eng_id;
> > -     } else
> > +     if ((unsigned int)eng_id >= ARRAY_SIZE(stream_enc_regs))
> 
> Could you replace the unsigned cast with an explicit bounds check, i.e.
> if (eng_id < 0 || eng_id >= ARRAY_SIZE(stream_enc_regs)) return NULL;
> It would be clearer about what values are being rejected.
> 

Also ARRAY_SIZE() is type size_t so type promotion would mean that it
was already cast to unsigned long.  Casting it to "unsigned int" makes
me itch because u32 is smaller than ulong normally.

regards,
dan carpenter

Reply via email to