All of lore.kernel.org
 help / color / mirror / Atom feed
* drivers/gpu/drm/amd/amdgpu/gfx_v12_1.c:2342 gfx_v12_1_xcc_kcq_resume() error: buffer overflow 'adev->gfx.compute_ring' 64 <= u32max
@ 2026-08-07  4:31 kernel test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2026-08-07  4:31 UTC (permalink / raw)
  To: oe-kbuild; +Cc: lkp, Dan Carpenter

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
CC: linux-kernel@vger.kernel.org
TO: Likun Gao <Likun.Gao@amd.com>
CC: Alex Deucher <alexander.deucher@amd.com>
CC: Hawking Zhang <Hawking.Zhang@amd.com>
CC: Mukul Joshi <mukul.joshi@amd.com>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   6c68fa601b49683ecb04eded993a71dfa8b2ba0b
commit: ad5f1ee0a9b03200b86db65fd946b686088b4b03 drm/amdgpu: Add initial support for gfx v12_1
date:   8 months ago
:::::: branch date: 8 hours ago
:::::: commit date: 8 months ago
config: i386-randconfig-141-20260806 (https://download.01.org/0day-ci/archive/20260807/202608071218.wh5gRlBP-lkp@intel.com/config)
compiler: clang version 22.1.3 (https://github.com/llvm/llvm-project e9846648fd6183ee6d8cbdb4502213fcf902a211)
smatch: v0.5.0-9187-g5189e3fb

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
| Fixes: ad5f1ee0a9b0 ("drm/amdgpu: Add initial support for gfx v12_1")
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202608071218.wh5gRlBP-lkp@intel.com/

smatch warnings:
drivers/gpu/drm/amd/amdgpu/gfx_v12_1.c:2342 gfx_v12_1_xcc_kcq_resume() error: buffer overflow 'adev->gfx.compute_ring' 64 <= u32max
drivers/gpu/drm/amd/amdgpu/gfx_v12_1.c:2397 gfx_v12_1_xcc_cp_resume() error: buffer overflow 'adev->gfx.compute_ring' 64 <= u32max
drivers/gpu/drm/amd/amdgpu/gfx_v12_1.c:3723 gfx_v12_1_set_ring_funcs() error: buffer overflow 'adev->gfx.compute_ring' 64 <= u32max

vim +2342 drivers/gpu/drm/amd/amdgpu/gfx_v12_1.c

ad5f1ee0a9b032 Likun Gao 2025-02-17  2331  
ad5f1ee0a9b032 Likun Gao 2025-02-17  2332  static int gfx_v12_1_xcc_kcq_resume(struct amdgpu_device *adev,
ad5f1ee0a9b032 Likun Gao 2025-02-17  2333  				    int xcc_id)
ad5f1ee0a9b032 Likun Gao 2025-02-17  2334  {
ad5f1ee0a9b032 Likun Gao 2025-02-17  2335  	struct amdgpu_ring *ring = NULL;
ad5f1ee0a9b032 Likun Gao 2025-02-17  2336  	int r = 0, i;
ad5f1ee0a9b032 Likun Gao 2025-02-17  2337  
ad5f1ee0a9b032 Likun Gao 2025-02-17  2338  	if (!amdgpu_async_gfx_ring)
ad5f1ee0a9b032 Likun Gao 2025-02-17  2339  		gfx_v12_1_xcc_cp_compute_enable(adev, true, xcc_id);
ad5f1ee0a9b032 Likun Gao 2025-02-17  2340  
ad5f1ee0a9b032 Likun Gao 2025-02-17  2341  	for (i = 0; i < adev->gfx.num_compute_rings; i++) {
ad5f1ee0a9b032 Likun Gao 2025-02-17 @2342  		ring = &adev->gfx.compute_ring[i + xcc_id * adev->gfx.num_compute_rings];
ad5f1ee0a9b032 Likun Gao 2025-02-17  2343  
ad5f1ee0a9b032 Likun Gao 2025-02-17  2344  		r = amdgpu_bo_reserve(ring->mqd_obj, false);
ad5f1ee0a9b032 Likun Gao 2025-02-17  2345  		if (unlikely(r != 0))
ad5f1ee0a9b032 Likun Gao 2025-02-17  2346  			goto done;
ad5f1ee0a9b032 Likun Gao 2025-02-17  2347  		r = amdgpu_bo_kmap(ring->mqd_obj, (void **)&ring->mqd_ptr);
ad5f1ee0a9b032 Likun Gao 2025-02-17  2348  		if (!r) {
ad5f1ee0a9b032 Likun Gao 2025-02-17  2349  			r = gfx_v12_1_xcc_kcq_init_queue(ring, xcc_id);
ad5f1ee0a9b032 Likun Gao 2025-02-17  2350  			amdgpu_bo_kunmap(ring->mqd_obj);
ad5f1ee0a9b032 Likun Gao 2025-02-17  2351  			ring->mqd_ptr = NULL;
ad5f1ee0a9b032 Likun Gao 2025-02-17  2352  		}
ad5f1ee0a9b032 Likun Gao 2025-02-17  2353  		amdgpu_bo_unreserve(ring->mqd_obj);
ad5f1ee0a9b032 Likun Gao 2025-02-17  2354  		if (r)
ad5f1ee0a9b032 Likun Gao 2025-02-17  2355  			goto done;
ad5f1ee0a9b032 Likun Gao 2025-02-17  2356  	}
ad5f1ee0a9b032 Likun Gao 2025-02-17  2357  
ad5f1ee0a9b032 Likun Gao 2025-02-17  2358  	r = amdgpu_gfx_enable_kcq(adev, xcc_id);
ad5f1ee0a9b032 Likun Gao 2025-02-17  2359  done:
ad5f1ee0a9b032 Likun Gao 2025-02-17  2360  	return r;
ad5f1ee0a9b032 Likun Gao 2025-02-17  2361  }
ad5f1ee0a9b032 Likun Gao 2025-02-17  2362  
ad5f1ee0a9b032 Likun Gao 2025-02-17  2363  static int gfx_v12_1_xcc_cp_resume(struct amdgpu_device *adev,
ad5f1ee0a9b032 Likun Gao 2025-02-17  2364  				   int xcc_id)
ad5f1ee0a9b032 Likun Gao 2025-02-17  2365  {
ad5f1ee0a9b032 Likun Gao 2025-02-17  2366  	int r, i;
ad5f1ee0a9b032 Likun Gao 2025-02-17  2367  	struct amdgpu_ring *ring;
ad5f1ee0a9b032 Likun Gao 2025-02-17  2368  
ad5f1ee0a9b032 Likun Gao 2025-02-17  2369  	if (!(adev->flags & AMD_IS_APU))
ad5f1ee0a9b032 Likun Gao 2025-02-17  2370  		gfx_v12_1_xcc_enable_gui_idle_interrupt(adev, false, xcc_id);
ad5f1ee0a9b032 Likun Gao 2025-02-17  2371  
ad5f1ee0a9b032 Likun Gao 2025-02-17  2372  	if (adev->firmware.load_type == AMDGPU_FW_LOAD_DIRECT) {
ad5f1ee0a9b032 Likun Gao 2025-02-17  2373  		/* legacy firmware loading */
ad5f1ee0a9b032 Likun Gao 2025-02-17  2374  		r = gfx_v12_1_xcc_cp_compute_load_microcode_rs64(adev, xcc_id);
ad5f1ee0a9b032 Likun Gao 2025-02-17  2375  		if (r)
ad5f1ee0a9b032 Likun Gao 2025-02-17  2376  			return r;
ad5f1ee0a9b032 Likun Gao 2025-02-17  2377  	}
ad5f1ee0a9b032 Likun Gao 2025-02-17  2378  
ad5f1ee0a9b032 Likun Gao 2025-02-17  2379  	gfx_v12_1_xcc_cp_set_doorbell_range(adev, xcc_id);
ad5f1ee0a9b032 Likun Gao 2025-02-17  2380  
ad5f1ee0a9b032 Likun Gao 2025-02-17  2381  	if (amdgpu_async_gfx_ring) {
ad5f1ee0a9b032 Likun Gao 2025-02-17  2382  		gfx_v12_1_xcc_cp_compute_enable(adev, true, xcc_id);
ad5f1ee0a9b032 Likun Gao 2025-02-17  2383  	}
ad5f1ee0a9b032 Likun Gao 2025-02-17  2384  
ad5f1ee0a9b032 Likun Gao 2025-02-17  2385  	if (adev->enable_mes_kiq && adev->mes.kiq_hw_init)
ad5f1ee0a9b032 Likun Gao 2025-02-17  2386  		r = amdgpu_mes_kiq_hw_init(adev, xcc_id);
ad5f1ee0a9b032 Likun Gao 2025-02-17  2387  	else
ad5f1ee0a9b032 Likun Gao 2025-02-17  2388  		r = gfx_v12_1_xcc_kiq_resume(adev, xcc_id);
ad5f1ee0a9b032 Likun Gao 2025-02-17  2389  	if (r)
ad5f1ee0a9b032 Likun Gao 2025-02-17  2390  		return r;
ad5f1ee0a9b032 Likun Gao 2025-02-17  2391  
ad5f1ee0a9b032 Likun Gao 2025-02-17  2392  	r = gfx_v12_1_xcc_kcq_resume(adev, xcc_id);
ad5f1ee0a9b032 Likun Gao 2025-02-17  2393  	if (r)
ad5f1ee0a9b032 Likun Gao 2025-02-17  2394  		return r;
ad5f1ee0a9b032 Likun Gao 2025-02-17  2395  
ad5f1ee0a9b032 Likun Gao 2025-02-17  2396  	for (i = 0; i < adev->gfx.num_compute_rings; i++) {
ad5f1ee0a9b032 Likun Gao 2025-02-17 @2397  		ring = &adev->gfx.compute_ring[i + xcc_id * adev->gfx.num_compute_rings];
ad5f1ee0a9b032 Likun Gao 2025-02-17  2398  		r = amdgpu_ring_test_helper(ring);
ad5f1ee0a9b032 Likun Gao 2025-02-17  2399  		if (r)
ad5f1ee0a9b032 Likun Gao 2025-02-17  2400  			return r;
ad5f1ee0a9b032 Likun Gao 2025-02-17  2401  	}
ad5f1ee0a9b032 Likun Gao 2025-02-17  2402  
ad5f1ee0a9b032 Likun Gao 2025-02-17  2403  	return 0;
ad5f1ee0a9b032 Likun Gao 2025-02-17  2404  }
ad5f1ee0a9b032 Likun Gao 2025-02-17  2405  

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* drivers/gpu/drm/amd/amdgpu/gfx_v12_1.c:2342 gfx_v12_1_xcc_kcq_resume() error: buffer overflow 'adev->gfx.compute_ring' 64 <= u32max
@ 2026-08-08 17:29 kernel test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2026-08-08 17:29 UTC (permalink / raw)
  To: oe-kbuild; +Cc: lkp, Dan Carpenter

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
CC: linux-kernel@vger.kernel.org
TO: Likun Gao <Likun.Gao@amd.com>
CC: Alex Deucher <alexander.deucher@amd.com>
CC: Hawking Zhang <Hawking.Zhang@amd.com>
CC: Mukul Joshi <mukul.joshi@amd.com>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   bcc44b6785f216eb939226ade6e3910baa30516b
commit: ad5f1ee0a9b03200b86db65fd946b686088b4b03 drm/amdgpu: Add initial support for gfx v12_1
date:   8 months ago
:::::: branch date: 18 hours ago
:::::: commit date: 8 months ago
config: i386-randconfig-141-20260806 (https://download.01.org/0day-ci/archive/20260809/202608090154.0inl91XY-lkp@intel.com/config)
compiler: clang version 22.1.3 (https://github.com/llvm/llvm-project e9846648fd6183ee6d8cbdb4502213fcf902a211)
smatch: v0.5.0-9187-g5189e3fb

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
| Fixes: ad5f1ee0a9b0 ("drm/amdgpu: Add initial support for gfx v12_1")
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202608090154.0inl91XY-lkp@intel.com/

smatch warnings:
drivers/gpu/drm/amd/amdgpu/gfx_v12_1.c:2342 gfx_v12_1_xcc_kcq_resume() error: buffer overflow 'adev->gfx.compute_ring' 64 <= u32max
drivers/gpu/drm/amd/amdgpu/gfx_v12_1.c:2397 gfx_v12_1_xcc_cp_resume() error: buffer overflow 'adev->gfx.compute_ring' 64 <= u32max
drivers/gpu/drm/amd/amdgpu/gfx_v12_1.c:3723 gfx_v12_1_set_ring_funcs() error: buffer overflow 'adev->gfx.compute_ring' 64 <= u32max

vim +2342 drivers/gpu/drm/amd/amdgpu/gfx_v12_1.c

ad5f1ee0a9b0320 Likun Gao 2025-02-17  2331  
ad5f1ee0a9b0320 Likun Gao 2025-02-17  2332  static int gfx_v12_1_xcc_kcq_resume(struct amdgpu_device *adev,
ad5f1ee0a9b0320 Likun Gao 2025-02-17  2333  				    int xcc_id)
ad5f1ee0a9b0320 Likun Gao 2025-02-17  2334  {
ad5f1ee0a9b0320 Likun Gao 2025-02-17  2335  	struct amdgpu_ring *ring = NULL;
ad5f1ee0a9b0320 Likun Gao 2025-02-17  2336  	int r = 0, i;
ad5f1ee0a9b0320 Likun Gao 2025-02-17  2337  
ad5f1ee0a9b0320 Likun Gao 2025-02-17  2338  	if (!amdgpu_async_gfx_ring)
ad5f1ee0a9b0320 Likun Gao 2025-02-17  2339  		gfx_v12_1_xcc_cp_compute_enable(adev, true, xcc_id);
ad5f1ee0a9b0320 Likun Gao 2025-02-17  2340  
ad5f1ee0a9b0320 Likun Gao 2025-02-17  2341  	for (i = 0; i < adev->gfx.num_compute_rings; i++) {
ad5f1ee0a9b0320 Likun Gao 2025-02-17 @2342  		ring = &adev->gfx.compute_ring[i + xcc_id * adev->gfx.num_compute_rings];
ad5f1ee0a9b0320 Likun Gao 2025-02-17  2343  
ad5f1ee0a9b0320 Likun Gao 2025-02-17  2344  		r = amdgpu_bo_reserve(ring->mqd_obj, false);
ad5f1ee0a9b0320 Likun Gao 2025-02-17  2345  		if (unlikely(r != 0))
ad5f1ee0a9b0320 Likun Gao 2025-02-17  2346  			goto done;
ad5f1ee0a9b0320 Likun Gao 2025-02-17  2347  		r = amdgpu_bo_kmap(ring->mqd_obj, (void **)&ring->mqd_ptr);
ad5f1ee0a9b0320 Likun Gao 2025-02-17  2348  		if (!r) {
ad5f1ee0a9b0320 Likun Gao 2025-02-17  2349  			r = gfx_v12_1_xcc_kcq_init_queue(ring, xcc_id);
ad5f1ee0a9b0320 Likun Gao 2025-02-17  2350  			amdgpu_bo_kunmap(ring->mqd_obj);
ad5f1ee0a9b0320 Likun Gao 2025-02-17  2351  			ring->mqd_ptr = NULL;
ad5f1ee0a9b0320 Likun Gao 2025-02-17  2352  		}
ad5f1ee0a9b0320 Likun Gao 2025-02-17  2353  		amdgpu_bo_unreserve(ring->mqd_obj);
ad5f1ee0a9b0320 Likun Gao 2025-02-17  2354  		if (r)
ad5f1ee0a9b0320 Likun Gao 2025-02-17  2355  			goto done;
ad5f1ee0a9b0320 Likun Gao 2025-02-17  2356  	}
ad5f1ee0a9b0320 Likun Gao 2025-02-17  2357  
ad5f1ee0a9b0320 Likun Gao 2025-02-17  2358  	r = amdgpu_gfx_enable_kcq(adev, xcc_id);
ad5f1ee0a9b0320 Likun Gao 2025-02-17  2359  done:
ad5f1ee0a9b0320 Likun Gao 2025-02-17  2360  	return r;
ad5f1ee0a9b0320 Likun Gao 2025-02-17  2361  }
ad5f1ee0a9b0320 Likun Gao 2025-02-17  2362  
ad5f1ee0a9b0320 Likun Gao 2025-02-17  2363  static int gfx_v12_1_xcc_cp_resume(struct amdgpu_device *adev,
ad5f1ee0a9b0320 Likun Gao 2025-02-17  2364  				   int xcc_id)
ad5f1ee0a9b0320 Likun Gao 2025-02-17  2365  {
ad5f1ee0a9b0320 Likun Gao 2025-02-17  2366  	int r, i;
ad5f1ee0a9b0320 Likun Gao 2025-02-17  2367  	struct amdgpu_ring *ring;
ad5f1ee0a9b0320 Likun Gao 2025-02-17  2368  
ad5f1ee0a9b0320 Likun Gao 2025-02-17  2369  	if (!(adev->flags & AMD_IS_APU))
ad5f1ee0a9b0320 Likun Gao 2025-02-17  2370  		gfx_v12_1_xcc_enable_gui_idle_interrupt(adev, false, xcc_id);
ad5f1ee0a9b0320 Likun Gao 2025-02-17  2371  
ad5f1ee0a9b0320 Likun Gao 2025-02-17  2372  	if (adev->firmware.load_type == AMDGPU_FW_LOAD_DIRECT) {
ad5f1ee0a9b0320 Likun Gao 2025-02-17  2373  		/* legacy firmware loading */
ad5f1ee0a9b0320 Likun Gao 2025-02-17  2374  		r = gfx_v12_1_xcc_cp_compute_load_microcode_rs64(adev, xcc_id);
ad5f1ee0a9b0320 Likun Gao 2025-02-17  2375  		if (r)
ad5f1ee0a9b0320 Likun Gao 2025-02-17  2376  			return r;
ad5f1ee0a9b0320 Likun Gao 2025-02-17  2377  	}
ad5f1ee0a9b0320 Likun Gao 2025-02-17  2378  
ad5f1ee0a9b0320 Likun Gao 2025-02-17  2379  	gfx_v12_1_xcc_cp_set_doorbell_range(adev, xcc_id);
ad5f1ee0a9b0320 Likun Gao 2025-02-17  2380  
ad5f1ee0a9b0320 Likun Gao 2025-02-17  2381  	if (amdgpu_async_gfx_ring) {
ad5f1ee0a9b0320 Likun Gao 2025-02-17  2382  		gfx_v12_1_xcc_cp_compute_enable(adev, true, xcc_id);
ad5f1ee0a9b0320 Likun Gao 2025-02-17  2383  	}
ad5f1ee0a9b0320 Likun Gao 2025-02-17  2384  
ad5f1ee0a9b0320 Likun Gao 2025-02-17  2385  	if (adev->enable_mes_kiq && adev->mes.kiq_hw_init)
ad5f1ee0a9b0320 Likun Gao 2025-02-17  2386  		r = amdgpu_mes_kiq_hw_init(adev, xcc_id);
ad5f1ee0a9b0320 Likun Gao 2025-02-17  2387  	else
ad5f1ee0a9b0320 Likun Gao 2025-02-17  2388  		r = gfx_v12_1_xcc_kiq_resume(adev, xcc_id);
ad5f1ee0a9b0320 Likun Gao 2025-02-17  2389  	if (r)
ad5f1ee0a9b0320 Likun Gao 2025-02-17  2390  		return r;
ad5f1ee0a9b0320 Likun Gao 2025-02-17  2391  
ad5f1ee0a9b0320 Likun Gao 2025-02-17  2392  	r = gfx_v12_1_xcc_kcq_resume(adev, xcc_id);
ad5f1ee0a9b0320 Likun Gao 2025-02-17  2393  	if (r)
ad5f1ee0a9b0320 Likun Gao 2025-02-17  2394  		return r;
ad5f1ee0a9b0320 Likun Gao 2025-02-17  2395  
ad5f1ee0a9b0320 Likun Gao 2025-02-17  2396  	for (i = 0; i < adev->gfx.num_compute_rings; i++) {
ad5f1ee0a9b0320 Likun Gao 2025-02-17 @2397  		ring = &adev->gfx.compute_ring[i + xcc_id * adev->gfx.num_compute_rings];
ad5f1ee0a9b0320 Likun Gao 2025-02-17  2398  		r = amdgpu_ring_test_helper(ring);
ad5f1ee0a9b0320 Likun Gao 2025-02-17  2399  		if (r)
ad5f1ee0a9b0320 Likun Gao 2025-02-17  2400  			return r;
ad5f1ee0a9b0320 Likun Gao 2025-02-17  2401  	}
ad5f1ee0a9b0320 Likun Gao 2025-02-17  2402  
ad5f1ee0a9b0320 Likun Gao 2025-02-17  2403  	return 0;
ad5f1ee0a9b0320 Likun Gao 2025-02-17  2404  }
ad5f1ee0a9b0320 Likun Gao 2025-02-17  2405  

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-08-08 17:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-08 17:29 drivers/gpu/drm/amd/amdgpu/gfx_v12_1.c:2342 gfx_v12_1_xcc_kcq_resume() error: buffer overflow 'adev->gfx.compute_ring' 64 <= u32max kernel test robot
  -- strict thread matches above, loose matches on Subject: below --
2026-08-07  4:31 kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.