summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdkfd
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2017-07-11 21:53:29 +0200
committerAlex Deucher <alexander.deucher@amd.com>2017-07-14 17:06:40 +0200
commit1d11ee89862ae7c1932e8b742fbb8340598f8874 (patch)
tree8eeefcdb8e4241e50315b892be5e472fffde1d9f /drivers/gpu/drm/amd/amdkfd
parentdrm/amdgpu: implement si_read_bios_from_rom (diff)
downloadlinux-1d11ee89862ae7c1932e8b742fbb8340598f8874.tar.xz
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/amdkfd')
-rw-r--r--drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
index 955aa304ff48..0def783889cd 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
@@ -671,7 +671,7 @@ static int set_sched_resources(struct device_queue_manager *dqm)
/* This situation may be hit in the future if a new HW
* generation exposes more than 64 queues. If so, the
* definition of res.queue_mask needs updating */
- if (WARN_ON(i > (sizeof(res.queue_mask)*8))) {
+ if (WARN_ON(i >= (sizeof(res.queue_mask)*8))) {
pr_err("Invalid queue enabled by amdgpu: %d\n", i);
break;
}