public inbox for linux-next@vger.kernel.org 
 help / color / mirror / Atom feed
From: coverity-bot <keescook@chromium•org>
To: Nirmoy Das <nirmoy.das@amd•com>
Cc: "Alex Deucher" <alexander.deucher@amd•com>,
	"Christian König" <christian.koenig@amd•com>,
	"Gustavo A. R. Silva" <gustavo@embeddedor•com>,
	linux-next@vger•kernel.org
Subject: Coverity: amdgpu_ring_init(): OVERRUN
Date: Tue, 14 Apr 2020 08:32:35 -0700	[thread overview]
Message-ID: <202004140832.AFDD14E3@keescook> (raw)

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):

Reported-by: coverity-bot <keescook+coverity-bot@chromium•org>
Addresses-Coverity-ID: 1492592 ("OVERRUN")
Fixes: 1c6d567bdf73 ("drm/amdgpu: rework sched_list generation")

Thanks for your attention!

-- 
Coverity-bot

                 reply	other threads:[~2020-04-14 15:32 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202004140832.AFDD14E3@keescook \
    --to=keescook@chromium$(echo .)org \
    --cc=alexander.deucher@amd$(echo .)com \
    --cc=christian.koenig@amd$(echo .)com \
    --cc=gustavo@embeddedor$(echo .)com \
    --cc=linux-next@vger$(echo .)kernel.org \
    --cc=nirmoy.das@amd$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox