Coverity: amdgpu_ring_init(): OVERRUN
Hello!
This is an experimental semi-automated report about issues detected by Coverity from a scan of next-20200414 as part of the linux-next scan project:
https://scan.coverity.com/projects/linux-next-weekly-scan
You're getting this email because you were associated with the identified lines of code (noted below) that were touched by commits:
Wed Apr 1 11:46:57 2020 +0200
1c6d567bdf73 ("drm/amdgpu: rework sched_list generation")
Coverity reported the following:
*** CID 1492592: (OVERRUN)
/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c: 266 in amdgpu_ring_init()
260 ring->priority = DRM_SCHED_PRIORITY_NORMAL;
261 mutex_init(&ring->priority_mutex);
262
263 if (!ring->no_scheduler) {
264 hw_ip = ring->funcs->type;
265 num_sched = &adev->gpu_sched[hw_ip][hw_prio].num_scheds;
vvv CID 1492592: (OVERRUN)
vvv Overrunning array "adev->gpu_sched" of 9 216-byte elements at element index 9 (byte offset 2159) using index "hw_ip" (which evaluates to 9).
266 adev->gpu_sched[hw_ip][hw_prio].sched[(*num_sched)++] =
267 &ring->sched;
268 }269
270 for (i = 0; i < DRM_SCHED_PRIORITY_MAX; ++i)
271 atomic_set(&ring->num_jobs[i], 0);
/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c: 265 in amdgpu_ring_init()
259 ring->max_dw = max_dw;
260 ring->priority = DRM_SCHED_PRIORITY_NORMAL;
261 mutex_init(&ring->priority_mutex);
262
263 if (!ring->no_scheduler) {
264 hw_ip = ring->funcs->type;
vvv CID 1492592: (OVERRUN)
vvv Overrunning array "adev->gpu_sched" of 9 216-byte elements at element index 9 (byte offset 2159) using index "hw_ip" (which evaluates to 9).
265 num_sched = &adev->gpu_sched[hw_ip][hw_prio].num_scheds;
266 adev->gpu_sched[hw_ip][hw_prio].sched[(*num_sched)++] =
267 &ring->sched;
268 }269
270 for (i = 0; i < DRM_SCHED_PRIORITY_MAX; ++i)
If this is a false positive, please let us know so we can mark it as such, or teach the Coverity rules to be smarter. If not, please make sure fixes get into linux-next. :) For patches fixing this, please include these lines (but double-check the "Fixes" first):
Addresses-Coverity-ID: 1492592 ("OVERRUN")
Thanks for your attention!
Signature · 1 line
Coverity-bot