summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
diff options
context:
space:
mode:
authorDan Carpenter2017-07-11 21:53:29 +0200
committerAlex Deucher2017-07-14 17:06:40 +0200
commit1d11ee89862ae7c1932e8b742fbb8340598f8874 (patch)
tree8eeefcdb8e4241e50315b892be5e472fffde1d9f /drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
parentdrm/amdgpu: implement si_read_bios_from_rom (diff)
downloadkernel-qcow2-linux-1d11ee89862ae7c1932e8b742fbb8340598f8874.tar.gz
kernel-qcow2-linux-1d11ee89862ae7c1932e8b742fbb8340598f8874.tar.xz
kernel-qcow2-linux-1d11ee89862ae7c1932e8b742fbb8340598f8874.zip
drm/amdgpu: Off by one sanity checks
This is just future proofing code, not something that can be triggered in real life. We're testing to make sure we don't shift wrap when we do "1ull << i" so "i" has to be in the 0-63 range. If it's 64 then we have gone too far. Acked-by: Christian König <christian.koenig@amd.com> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
index 4bb12ee46315..3fbc7b22446c 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
@@ -4564,7 +4564,7 @@ static int gfx_v8_0_kiq_kcq_enable(struct amdgpu_device *adev)
/* This situation may be hit in the future if a new HW
* generation exposes more than 64 queues. If so, the
* definition of queue_mask needs updating */
- if (WARN_ON(i > (sizeof(queue_mask)*8))) {
+ if (WARN_ON(i >= (sizeof(queue_mask)*8))) {
DRM_ERROR("Invalid KCQ enabled: %d\n", i);
break;
}