drm/amdgpu: bounds check xcp ip block index
Subsystems (2)
PATCH 1/1 drm/amdgpu: bounds check xcp ip block index
Check out of range values for ip block.
Signed-off-by Lijo Lazar <[email protected]>
--- drivers/gpu/drm/amd/amdgpu/amdgpu_xcp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_xcp.c +2 -1
@@ -381,7 +381,8 @@ int amdgpu_xcp_get_inst_details(struct amdgpu_xcp *xcp, enum AMDGPU_XCP_IP_BLOCK ip, uint32_t *inst_mask) { -if (!xcp->valid || !inst_mask || !(xcp->ip[ip].valid)) +if (!xcp->valid || !inst_mask || ip >=AMDGPU_XCP_MAX_BLOCKS || + !(xcp->ip[ip].valid))return -EINVAL ; *inst_mask = xcp->ip[ip].inst_mask;
Signature · 1 line
2.49.0
AMD General
Reviewed-by Asad Kamal <[email protected]>
Thanks & Regards
Asad
-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Thursday, June 18, 2026 10:46 AM
To: [email protected]
Cc: Zhang, Hawking <[email protected]>; Deucher, Alexander <[email protected]>; Kamal, Asad <[email protected]>; Li, Candice <[email protected]>
Subject: [PATCH] drm/amdgpu: bounds check xcp ip block index
Check out of range values for ip block.
Signed-off-by Lijo Lazar <[email protected]>
--- drivers/gpu/drm/amd/amdgpu/amdgpu_xcp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_xcp.c +2 -1
@@ -381,7 +381,8 @@ int amdgpu_xcp_get_inst_details(struct amdgpu_xcp *xcp, enum AMDGPU_XCP_IP_BLOCK ip, uint32_t *inst_mask) { -if (!xcp->valid || !inst_mask || !(xcp->ip[ip].valid)) +if (!xcp->valid || !inst_mask || ip >=AMDGPU_XCP_MAX_BLOCKS || + !(xcp->ip[ip].valid))return -EINVAL ; *inst_mask = xcp->ip[ip].inst_mask;
--
2.49.0