* [drm-amdgpu:drm-amdgpu-next 148/243] drivers/gpu/drm/amd/amdgpu/gfx_v12_1.c:3781 gfx_v12_1_pre_px_switch() error: buffer overflow 'adev->mes.ring' 16 <= s32max
@ 2026-11-25 19:39 kernel test robot
0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2026-11-25 19:39 UTC (permalink / raw)
To: oe-kbuild; +Cc: lkp, Dan Carpenter
Unfiltered warning: this smatch report is sent as-is and has not been
reviewed for false positives, so please treat it with due skepticism.
BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
TO: Alex Sierra <alex.sierra@amd.com>
CC: Alex Deucher <alexander.deucher@amd.com>
CC: Lijo Lazar <lijo.lazar@amd.com>
tree: https://gitlab.freedesktop.org/drm/amdgpu/kernel drm-amdgpu-next
head: a69db917063c539fa09325ea22f3ff7b0626b478
commit: 5092fbd745ae7b36bdc9ef775d4b9012e5d5dcb6 [148/243] drm/amdgpu: reinitialize GFX compute across a partition switch
:::::: branch date: 5 hours ago
:::::: commit date: 23 hours ago
config: sparc64-randconfig-2200-20261125 (https://download.01.org/0day-ci/archive/20261125/20261125203106.sVpgvhnY-lkp@intel.com/config)
compiler: sparc64-linux-gcc (GCC) 15.3.0
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
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/20261125203106.sVpgvhnY-lkp@intel.com/
New smatch warnings:
drivers/gpu/drm/amd/amdgpu/gfx_v12_1.c:3781 gfx_v12_1_pre_px_switch() error: buffer overflow 'adev->mes.ring' 16 <= s32max
Old smatch warnings:
drivers/gpu/drm/amd/amdgpu/gfx_v12_1.c:2414 gfx_v12_1_xcc_kcq_resume() error: buffer overflow 'adev->gfx.compute_ring' 64 <= u32max
drivers/gpu/drm/amd/amdgpu/gfx_v12_1.c:2471 gfx_v12_1_xcc_cp_resume() error: buffer overflow 'adev->gfx.compute_ring' 64 <= u32max
drivers/gpu/drm/amd/amdgpu/gfx_v12_1.c:3875 gfx_v12_1_set_ring_funcs() error: buffer overflow 'adev->gfx.compute_ring' 64 <= u32max
vim +3781 drivers/gpu/drm/amd/amdgpu/gfx_v12_1.c
ad5f1ee0a9b032 Likun Gao 2025-02-17 3766
5092fbd745ae7b Alex Sierra 2026-10-29 3767 /*
5092fbd745ae7b Alex Sierra 2026-10-29 3768 * A runtime partition switch does not pass through GFX hw_fini/hw_init.
5092fbd745ae7b Alex Sierra 2026-10-29 3769 * Stop the GFX compute path while the old partition is still programmed,
5092fbd745ae7b Alex Sierra 2026-10-29 3770 * then restore it after the new mode is committed.
5092fbd745ae7b Alex Sierra 2026-10-29 3771 */
5092fbd745ae7b Alex Sierra 2026-10-29 3772 static int gfx_v12_1_pre_px_switch(struct amdgpu_ip_block *ip_block)
5092fbd745ae7b Alex Sierra 2026-10-29 3773 {
5092fbd745ae7b Alex Sierra 2026-10-29 3774 struct amdgpu_device *adev = ip_block->adev;
5092fbd745ae7b Alex Sierra 2026-10-29 3775 int xcc_id, pipe, num_xcc = NUM_XCC(adev->gfx.xcc_mask);
5092fbd745ae7b Alex Sierra 2026-10-29 3776
5092fbd745ae7b Alex Sierra 2026-10-29 3777 if (!adev->enable_mes_kiq)
5092fbd745ae7b Alex Sierra 2026-10-29 3778 return 0;
5092fbd745ae7b Alex Sierra 2026-10-29 3779
5092fbd745ae7b Alex Sierra 2026-10-29 3780 for (xcc_id = 0; xcc_id < num_xcc; xcc_id++) {
5092fbd745ae7b Alex Sierra 2026-10-29 @3781 if (!adev->mes.ring[MES_PIPE_INST(xcc_id,
5092fbd745ae7b Alex Sierra 2026-10-29 3782 AMDGPU_MES_SCHED_PIPE)].sched.ready)
5092fbd745ae7b Alex Sierra 2026-10-29 3783 return 0;
5092fbd745ae7b Alex Sierra 2026-10-29 3784 }
5092fbd745ae7b Alex Sierra 2026-10-29 3785
5092fbd745ae7b Alex Sierra 2026-10-29 3786 for (xcc_id = 0; xcc_id < num_xcc; xcc_id++)
5092fbd745ae7b Alex Sierra 2026-10-29 3787 gfx_v12_1_xcc_fini(adev, xcc_id);
5092fbd745ae7b Alex Sierra 2026-10-29 3788
5092fbd745ae7b Alex Sierra 2026-10-29 3789 /*
5092fbd745ae7b Alex Sierra 2026-10-29 3790 * MES firmware restarts with its read pointer at zero. Clear both
5092fbd745ae7b Alex Sierra 2026-10-29 3791 * rings and their writeback pointers before bringing the GFX compute
5092fbd745ae7b Alex Sierra 2026-10-29 3792 * path back up, otherwise firmware can replay stale packets.
5092fbd745ae7b Alex Sierra 2026-10-29 3793 */
5092fbd745ae7b Alex Sierra 2026-10-29 3794 for (xcc_id = 0; xcc_id < num_xcc; xcc_id++) {
5092fbd745ae7b Alex Sierra 2026-10-29 3795 for (pipe = 0; pipe < AMDGPU_MAX_MES_PIPES; pipe++)
5092fbd745ae7b Alex Sierra 2026-10-29 3796 amdgpu_ring_clear_ring_and_ptrs(
5092fbd745ae7b Alex Sierra 2026-10-29 3797 &adev->mes.ring[MES_PIPE_INST(xcc_id, pipe)]);
5092fbd745ae7b Alex Sierra 2026-10-29 3798 }
5092fbd745ae7b Alex Sierra 2026-10-29 3799
5092fbd745ae7b Alex Sierra 2026-10-29 3800 adev->gfx.px_switch_stopped = true;
5092fbd745ae7b Alex Sierra 2026-10-29 3801 return 0;
5092fbd745ae7b Alex Sierra 2026-10-29 3802 }
5092fbd745ae7b Alex Sierra 2026-10-29 3803
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-11-25 19:40 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-25 19:39 [drm-amdgpu:drm-amdgpu-next 148/243] drivers/gpu/drm/amd/amdgpu/gfx_v12_1.c:3781 gfx_v12_1_pre_px_switch() error: buffer overflow 'adev->mes.ring' 16 <= s32max 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.