mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: kernel test robot <yujie.liu@intel.com>
To: Arunpravin <Arunpravin.PaneerSelvam@amd.com>
Cc: <llvm@lists.linux.dev>, <kbuild-all@lists.01.org>,
	"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>
Subject: drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:236:9: warning: The left expression of the compound assignment is an uninitialized value. The computed value will also be garbage [clang-analyzer-core.uninitialized.Assign]
Date: Sat, 13 Nov 2021 23:01:50 +0800	[thread overview]
Message-ID: <af964ce4-d96e-f69b-9027-c2a8556788f9@intel.com> (raw)
In-Reply-To: <202111070213.v16ZzQZy-lkp@intel.com>

[-- Attachment #1: Type: text/plain, Size: 4671 bytes --]

tree:   https://github.com/0day-ci/linux/commits/Arunpravin/Enable-buddy-memory-manager-support/20210921-032602
head:   71b3775a5ce7b59e8c5292ae438284e8569c9e9f
commit: 71b3775a5ce7b59e8c5292ae438284e8569c9e9f Add drm buddy manager support to amdgpu driver
date:   7 weeks ago
config: riscv-randconfig-c006-20210927 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project dc6e8dfdfe7efecfda318d43a06fae18b40eb498)
reproduce (this is a W=1 build):
         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
         chmod +x ~/bin/make.cross
         # install riscv cross compiling tool for clang build
         # apt-get install binutils-riscv64-linux-gnu
         # https://github.com/0day-ci/linux/commit/71b3775a5ce7b59e8c5292ae438284e8569c9e9f
         git remote add linux-review https://github.com/0day-ci/linux
         git fetch --no-tags linux-review Arunpravin/Enable-buddy-memory-manager-support/20210921-032602
         git checkout 71b3775a5ce7b59e8c5292ae438284e8569c9e9f
         # save the attached .config to linux build tree
         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=riscv clang-analyzer

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


clang-analyzer warnings: (new ones prefixed by >>)

 >> drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:236:9: warning: The left expression of the compound assignment is an uninitialized value. The computed value will also be garbage [clang-analyzer-core.uninitialized.Assign]
                    usage += amdgpu_vram_mgr_vis_size(adev, block);
                    ~~~~~ ^
    drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:227:2: note: 'usage' declared without an initial value
            u64 usage;
            ^~~~~~~~~
    drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:236:9: note: The left expression of the compound assignment is an uninitialized value. The computed value will also be garbage
                    usage += amdgpu_vram_mgr_vis_size(adev, block);
                    ~~~~~ ^
 >> drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:238:2: warning: Undefined or garbage value returned to caller [clang-analyzer-core.uninitialized.UndefReturn]
            return usage;
            ^      ~~~~~


vim +236 drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c

3c848bb38aca1f Christian König 2017-08-07  212
5e9244ff585239 Michel Dänzer   2018-06-12  213  /**
ddc21af4d0f37f Michel Dänzer   2018-07-11  214   * amdgpu_vram_mgr_bo_visible_size - CPU visible BO size
5e9244ff585239 Michel Dänzer   2018-06-12  215   *
5e9244ff585239 Michel Dänzer   2018-06-12  216   * @bo: &amdgpu_bo buffer object (must be in VRAM)
5e9244ff585239 Michel Dänzer   2018-06-12  217   *
5e9244ff585239 Michel Dänzer   2018-06-12  218   * Returns:
ddc21af4d0f37f Michel Dänzer   2018-07-11  219   * How much of the given &amdgpu_bo buffer object lies in CPU visible VRAM.
5e9244ff585239 Michel Dänzer   2018-06-12  220   */
ddc21af4d0f37f Michel Dänzer   2018-07-11  221  u64 amdgpu_vram_mgr_bo_visible_size(struct amdgpu_bo *bo)
5e9244ff585239 Michel Dänzer   2018-06-12  222  {
7303b39e46b2f5 Michel Dänzer   2018-06-14  223  	struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev);
cb1c81467af355 Christian König 2021-04-30  224  	struct ttm_resource *res = bo->tbo.resource;
71b3775a5ce7b5 Arunpravin      2021-09-21  225  	struct amdgpu_vram_mgr_node *vnode = to_amdgpu_vram_mgr_node(res);
71b3775a5ce7b5 Arunpravin      2021-09-21  226  	struct drm_buddy_block *block;
ddc21af4d0f37f Michel Dänzer   2018-07-11  227  	u64 usage;
5e9244ff585239 Michel Dänzer   2018-06-12  228
9735bf1930e658 Michel Dänzer   2018-06-15  229  	if (amdgpu_gmc_vram_full_visible(&adev->gmc))
ddc21af4d0f37f Michel Dänzer   2018-07-11  230  		return amdgpu_bo_size(bo);
7303b39e46b2f5 Michel Dänzer   2018-06-14  231
cb1c81467af355 Christian König 2021-04-30  232  	if (res->start >= adev->gmc.visible_vram_size >> PAGE_SHIFT)
ddc21af4d0f37f Michel Dänzer   2018-07-11  233  		return 0;
7303b39e46b2f5 Michel Dänzer   2018-06-14  234
71b3775a5ce7b5 Arunpravin      2021-09-21  235  	list_for_each_entry(block, &vnode->blocks, link)
71b3775a5ce7b5 Arunpravin      2021-09-21 @236  		usage += amdgpu_vram_mgr_vis_size(adev, block);
7303b39e46b2f5 Michel Dänzer   2018-06-14  237
7303b39e46b2f5 Michel Dänzer   2018-06-14 @238  	return usage;
5e9244ff585239 Michel Dänzer   2018-06-12  239  }
5e9244ff585239 Michel Dänzer   2018-06-12  240

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 34155 bytes --]

           reply	other threads:[~2021-11-13 15:02 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <202111070213.v16ZzQZy-lkp@intel.com>]

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=af964ce4-d96e-f69b-9027-c2a8556788f9@intel.com \
    --to=yujie.liu@intel.com \
    --cc=Arunpravin.PaneerSelvam@amd.com \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=llvm@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

all inboxes | Powered by JetHome®