]> git.ipfire.org Git - thirdparty/linux.git/commit
drm/amdgpu: Remove dead negative offset check in amdgpu_virt_init_critical_region()
authorSrinivasan Shanmugam <srinivasan.shanmugam@amd.com>
Thu, 12 Mar 2026 13:23:59 +0000 (18:53 +0530)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 17 Mar 2026 21:47:59 +0000 (17:47 -0400)
commit4fce3dfab54d60ebaff1c7a9020a730a0708b705
tree0c7116a351d6be020f630a536ca39ebf755a5c9f
parenta1c1c77d30cd497ad6dd6062f8a5c06b38a45132
drm/amdgpu: Remove dead negative offset check in amdgpu_virt_init_critical_region()

amdgpu_virt_init_critical_region() stores init_hdr_offset as u64.
The subsequent check for init_hdr_offset < 0 is therefore always false.

Drop the unreachable validation and rely on the existing
check_add_overflow() and VRAM end bounds check for offset validation.

This resolves the Smatch warning about comparing an unsigned value
against zero.

drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c:953 amdgpu_virt_init_critical_region() warn: unsigned 'init_hdr_offset' is never less than zero.

Fixes: 07009df6494d ("drm/amdgpu: Introduce SRIOV critical regions v2 during VF init")
Cc: Dan Carpenter <dan.carpenter@linaro.org>
Cc: Ellen Pan <yunru.pan@amd.com>
Cc: Lijo Lazar <lijo.lazar@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: Christian König <christian.koenig@amd.com>
Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>
Reviewed-by: Bokun Zhang <bokun.zhang@amd.com>
Reviewed-by: Ellen Pan <yunru.pan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c