提交 a2b45994 编写于 作者: G Guchun Chen 提交者: Alex Deucher

drm/amdgpu: add check to avoid array bound issue

Sub_block_index can be passed from user level, so
add one check before accessing the array first to
prevent array index out of bound problem.
Signed-off-by: NGuchun Chen <guchun.chen@amd.com>
Reviewed-by: NTao Zhou <tao.zhou1@amd.com>
Signed-off-by: NAlex Deucher <alexander.deucher@amd.com>
上级 3c0b547d
......@@ -5978,6 +5978,9 @@ static int gfx_v9_0_ras_error_inject(struct amdgpu_device *adev,
if (adev->asic_type != CHIP_VEGA20)
return -EINVAL;
if (info->head.sub_block_index >= ARRAY_SIZE(ras_gfx_subblocks))
return -EINVAL;
if (!ras_gfx_subblocks[info->head.sub_block_index].name)
return -EPERM;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册