lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:   Wed, 20 Sep 2023 00:23:20 +0800
From:   kernel test robot <lkp@...el.com>
To:     Danilo Krummrich <dakr@...hat.com>
Cc:     oe-kbuild-all@...ts.linux.dev, linux-kernel@...r.kernel.org,
        Dave Airlie <airlied@...hat.com>
Subject: drivers/gpu/drm/nouveau/nouveau_gem.c:195:16: warning: array
 subscript 0 is outside array bounds of 'struct nouveau_vmm[0]'

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   2cf0f715623872823a72e451243bbf555d10d032
commit: b88baab828713ce0b49b185444b2ee83bed373a8 drm/nouveau: implement new VM_BIND uAPI
date:   7 weeks ago
config: arm-defconfig (https://download.01.org/0day-ci/archive/20230920/202309200028.GO8pvnyf-lkp@intel.com/config)
compiler: arm-linux-gnueabi-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20230920/202309200028.GO8pvnyf-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@...el.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202309200028.GO8pvnyf-lkp@intel.com/

All warnings (new ones prefixed by >>):

   drivers/gpu/drm/nouveau/nouveau_gem.c: In function 'nouveau_gem_object_close':
>> drivers/gpu/drm/nouveau/nouveau_gem.c:195:16: warning: array subscript 0 is outside array bounds of 'struct nouveau_vmm[0]' [-Warray-bounds=]
     195 |         if (vmm->vmm.object.oclass < NVIF_CLASS_VMM_NV50)
         |                ^~
   cc1: note: source object is likely at address zero
>> drivers/gpu/drm/nouveau/nouveau_gem.c:195:16: warning: array subscript 0 is outside array bounds of 'struct nouveau_vmm[0]' [-Warray-bounds=]
   cc1: note: source object is likely at address zero
>> drivers/gpu/drm/nouveau/nouveau_gem.c:195:16: warning: array subscript 0 is outside array bounds of 'struct nouveau_vmm[0]' [-Warray-bounds=]
   cc1: note: source object is likely at address zero
   cc1: note: source object is likely at address zero


vim +195 drivers/gpu/drm/nouveau/nouveau_gem.c

c4c7044ffc1ba9 Ben Skeggs       2013-05-07  183  
639212d0115726 Ben Skeggs       2011-06-03  184  void
639212d0115726 Ben Skeggs       2011-06-03  185  nouveau_gem_object_close(struct drm_gem_object *gem, struct drm_file *file_priv)
639212d0115726 Ben Skeggs       2011-06-03  186  {
ebb945a94bba2c Ben Skeggs       2012-07-20  187  	struct nouveau_cli *cli = nouveau_cli(file_priv);
2fd3db6f145705 Ben Skeggs       2011-06-07  188  	struct nouveau_bo *nvbo = nouveau_gem_object(gem);
5cc8d536c21a17 Ben Skeggs       2014-12-11  189  	struct nouveau_drm *drm = nouveau_bdev(nvbo->bo.bdev);
5cc8d536c21a17 Ben Skeggs       2014-12-11  190  	struct device *dev = drm->dev->dev;
7b05a7c0c9ca6e Danilo Krummrich 2023-08-04  191  	struct nouveau_vmm *vmm = nouveau_cli_vmm(cli);
24e8375b1bfdf7 Ben Skeggs       2017-11-01  192  	struct nouveau_vma *vma;
2fd3db6f145705 Ben Skeggs       2011-06-07  193  	int ret;
639212d0115726 Ben Skeggs       2011-06-03  194  
bfe91afaca5925 Ben Skeggs       2019-02-19 @195  	if (vmm->vmm.object.oclass < NVIF_CLASS_VMM_NV50)
639212d0115726 Ben Skeggs       2011-06-03  196  		return;
2fd3db6f145705 Ben Skeggs       2011-06-07  197  
b88baab828713c Danilo Krummrich 2023-08-04  198  	if (nouveau_cli_uvmm(cli))
b88baab828713c Danilo Krummrich 2023-08-04  199  		return;
b88baab828713c Danilo Krummrich 2023-08-04  200  
dfd5e50ea43ca4 Christian König  2016-04-06  201  	ret = ttm_bo_reserve(&nvbo->bo, false, false, NULL);
2fd3db6f145705 Ben Skeggs       2011-06-07  202  	if (ret)
2fd3db6f145705 Ben Skeggs       2011-06-07  203  		return;
2fd3db6f145705 Ben Skeggs       2011-06-07  204  
bfe91afaca5925 Ben Skeggs       2019-02-19  205  	vma = nouveau_vma_find(nvbo, vmm);
2fd3db6f145705 Ben Skeggs       2011-06-07  206  	if (vma) {
24e8375b1bfdf7 Ben Skeggs       2017-11-01  207  		if (--vma->refs == 0) {
5cc8d536c21a17 Ben Skeggs       2014-12-11  208  			ret = pm_runtime_get_sync(dev);
5cc8d536c21a17 Ben Skeggs       2014-12-11  209  			if (!WARN_ON(ret < 0 && ret != -EACCES)) {
c4c7044ffc1ba9 Ben Skeggs       2013-05-07  210  				nouveau_gem_object_unmap(nvbo, vma);
5cc8d536c21a17 Ben Skeggs       2014-12-11  211  				pm_runtime_mark_last_busy(dev);
5cc8d536c21a17 Ben Skeggs       2014-12-11  212  			}
d3faddc7dcd326 Dinghao Liu      2020-05-20  213  			pm_runtime_put_autosuspend(dev);
5cc8d536c21a17 Ben Skeggs       2014-12-11  214  		}
2fd3db6f145705 Ben Skeggs       2011-06-07  215  	}
2fd3db6f145705 Ben Skeggs       2011-06-07  216  	ttm_bo_unreserve(&nvbo->bo);
639212d0115726 Ben Skeggs       2011-06-03  217  }
639212d0115726 Ben Skeggs       2011-06-03  218  

:::::: The code at line 195 was first introduced by commit
:::::: bfe91afaca59251fbf5d62143fdd8f740b551302 drm/nouveau: prepare for enabling svm with existing userspace interfaces

:::::: TO: Ben Skeggs <bskeggs@...hat.com>
:::::: CC: Ben Skeggs <bskeggs@...hat.com>

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ