From: jsg Date: Mon, 9 Sep 2024 09:19:49 +0000 (+0000) Subject: drm/amdgpu: Fix out-of-bounds read of df_v1_7_channel_number X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=596a3c2efe3ccff4296542362fff7f2071764a19;p=openbsd drm/amdgpu: Fix out-of-bounds read of df_v1_7_channel_number From Ma Jun f9267972490f9fcffe146e79828e97acc0da588c in linux-6.6.y/6.6.50 d768394fa99467bcf2703bde74ddc96eeb0b71fa in mainline linux --- diff --git a/sys/dev/pci/drm/amd/amdgpu/df_v1_7.c b/sys/dev/pci/drm/amd/amdgpu/df_v1_7.c index 5dfab80ffff..cd298556f7a 100644 --- a/sys/dev/pci/drm/amd/amdgpu/df_v1_7.c +++ b/sys/dev/pci/drm/amd/amdgpu/df_v1_7.c @@ -70,6 +70,8 @@ static u32 df_v1_7_get_hbm_channel_number(struct amdgpu_device *adev) int fb_channel_number; fb_channel_number = adev->df.funcs->get_fb_channel_number(adev); + if (fb_channel_number >= ARRAY_SIZE(df_v1_7_channel_number)) + fb_channel_number = 0; return df_v1_7_channel_number[fb_channel_number]; }