From: Dan Carpenter <error27@gmail.com>
To: oe-kbuild@lists.linux.dev, Luben Tuikov <luben.tuikov@amd.com>
Cc: lkp@intel.com, oe-kbuild-all@lists.linux.dev,
linux-kernel@vger.kernel.org,
"Alex Deucher" <alexander.deucher@amd.com>,
"Christian König" <christian.koenig@amd.com>
Subject: drivers/gpu/drm/amd/amdgpu/amdgpu_object.c:473 amdgpu_bo_validate_size() error: we previously assumed 'man' could be null (see line 458)
Date: Tue, 3 Jan 2023 11:01:04 +0300 [thread overview]
Message-ID: <202212300020.CFmsapaG-lkp@intel.com> (raw)
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 1b929c02afd37871d5afb9d498426f83432e71c2
commit: 7554886daa31eacc8e7fac9e15bbce67d10b8f1f drm/amdgpu: Fix size validation for non-exclusive domains (v4)
config: ia64-randconfig-m041-20221229
compiler: ia64-linux-gcc (GCC) 12.1.0
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
smatch warnings:
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c:473 amdgpu_bo_validate_size() error: we previously assumed 'man' could be null (see line 458)
vim +/man +473 drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
79c631239a83ae Andrey Grodzovsky 2017-11-10 444 static bool amdgpu_bo_validate_size(struct amdgpu_device *adev,
79c631239a83ae Andrey Grodzovsky 2017-11-10 445 unsigned long size, u32 domain)
79c631239a83ae Andrey Grodzovsky 2017-11-10 446 {
9de59bc201496f Dave Airlie 2020-08-04 447 struct ttm_resource_manager *man = NULL;
79c631239a83ae Andrey Grodzovsky 2017-11-10 448
79c631239a83ae Andrey Grodzovsky 2017-11-10 449 /*
79c631239a83ae Andrey Grodzovsky 2017-11-10 450 * If GTT is part of requested domains the check must succeed to
7554886daa31ea Luben Tuikov 2022-12-10 451 * allow fall back to GTT.
79c631239a83ae Andrey Grodzovsky 2017-11-10 452 */
79c631239a83ae Andrey Grodzovsky 2017-11-10 453 if (domain & AMDGPU_GEM_DOMAIN_GTT) {
6c28aed6e5b7fa Dave Airlie 2020-08-04 454 man = ttm_manager_type(&adev->mman.bdev, TTM_PL_TT);
79c631239a83ae Andrey Grodzovsky 2017-11-10 455
7554886daa31ea Luben Tuikov 2022-12-10 456 if (man && size < man->size)
79c631239a83ae Andrey Grodzovsky 2017-11-10 457 return true;
7554886daa31ea Luben Tuikov 2022-12-10 @458 else if (!man)
7554886daa31ea Luben Tuikov 2022-12-10 459 WARN_ON_ONCE("GTT domain requested but GTT mem manager uninitialized");
WARN()
79c631239a83ae Andrey Grodzovsky 2017-11-10 460 goto fail;
7554886daa31ea Luben Tuikov 2022-12-10 461 } else if (domain & AMDGPU_GEM_DOMAIN_VRAM) {
6c28aed6e5b7fa Dave Airlie 2020-08-04 462 man = ttm_manager_type(&adev->mman.bdev, TTM_PL_VRAM);
79c631239a83ae Andrey Grodzovsky 2017-11-10 463
7554886daa31ea Luben Tuikov 2022-12-10 464 if (man && size < man->size)
79c631239a83ae Andrey Grodzovsky 2017-11-10 465 return true;
79c631239a83ae Andrey Grodzovsky 2017-11-10 466 goto fail;
79c631239a83ae Andrey Grodzovsky 2017-11-10 467 }
79c631239a83ae Andrey Grodzovsky 2017-11-10 468
79c631239a83ae Andrey Grodzovsky 2017-11-10 469 /* TODO add more domains checks, such as AMDGPU_GEM_DOMAIN_CPU */
79c631239a83ae Andrey Grodzovsky 2017-11-10 470 return true;
79c631239a83ae Andrey Grodzovsky 2017-11-10 471
79c631239a83ae Andrey Grodzovsky 2017-11-10 472 fail:
299c776cebb01c Michel Dänzer 2017-11-15 @473 DRM_DEBUG("BO size %lu > total memory in domain: %llu\n", size,
4499c90e902f39 Christian König 2022-03-11 474 man->size);
Followed by crash.
79c631239a83ae Andrey Grodzovsky 2017-11-10 475 return false;
79c631239a83ae Andrey Grodzovsky 2017-11-10 476 }
--
0-DAY CI Kernel Test Service
https://01.org/lkp
reply other threads:[~2023-01-03 8:01 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=202212300020.CFmsapaG-lkp@intel.com \
--to=error27@gmail.com \
--cc=alexander.deucher@amd.com \
--cc=christian.koenig@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lkp@intel.com \
--cc=luben.tuikov@amd.com \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=oe-kbuild@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
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