From: kernel test robot <lkp@intel.com>
To: oe-kbuild@lists.linux.dev
Cc: lkp@intel.com, Dan Carpenter <error27@gmail.com>
Subject: drivers/gpu/drm/nouveau/nvkm/engine/gr/gv100.c:263 gv100_gr_oneinit_sm_id() warn: potentially one past the end of array 'gpc_tpc_mask[gpc_table[gtpc]]'
Date: Sun, 3 Dec 2023 21:46:18 +0800 [thread overview]
Message-ID: <202312032140.sb2aZTLS-lkp@intel.com> (raw)
BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
CC: linux-kernel@vger.kernel.org
TO: Ben Skeggs <bskeggs@redhat.com>
CC: Lyude Paul <lyude@redhat.com>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 33cc938e65a98f1d29d0a18403dbbee050dcad9a
commit: 3ffa6f329b610029b44ebd7bc2320a92468a0e42 drm/nouveau/gr/gv100-: port smid mapping code from nvgpu
date: 1 year, 1 month ago
:::::: branch date: 3 hours ago
:::::: commit date: 1 year, 1 month ago
config: i386-randconfig-141-20231105 (https://download.01.org/0day-ci/archive/20231203/202312032140.sb2aZTLS-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce: (https://download.01.org/0day-ci/archive/20231203/202312032140.sb2aZTLS-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@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202312032140.sb2aZTLS-lkp@intel.com/
smatch warnings:
drivers/gpu/drm/nouveau/nvkm/engine/gr/gv100.c:263 gv100_gr_oneinit_sm_id() warn: potentially one past the end of array 'gpc_tpc_mask[gpc_table[gtpc]]'
drivers/gpu/drm/nouveau/nvkm/engine/gr/gv100.c:263 gv100_gr_oneinit_sm_id() warn: potentially one past the end of array 'gpc_tpc_mask[gpc_table[gtpc]]'
vim +263 drivers/gpu/drm/nouveau/nvkm/engine/gr/gv100.c
3ffa6f329b6100 Ben Skeggs 2022-06-01 225
3ffa6f329b6100 Ben Skeggs 2022-06-01 226 int
3ffa6f329b6100 Ben Skeggs 2022-06-01 227 gv100_gr_oneinit_sm_id(struct gf100_gr *gr)
3ffa6f329b6100 Ben Skeggs 2022-06-01 228 {
3ffa6f329b6100 Ben Skeggs 2022-06-01 229 unsigned long *gpc_tpc_mask;
3ffa6f329b6100 Ben Skeggs 2022-06-01 230 u32 *tpc_table, *gpc_table;
3ffa6f329b6100 Ben Skeggs 2022-06-01 231 u32 gpc, tpc, pes, gtpc;
3ffa6f329b6100 Ben Skeggs 2022-06-01 232 int perf, maxperf, ret = 0;
3ffa6f329b6100 Ben Skeggs 2022-06-01 233
3ffa6f329b6100 Ben Skeggs 2022-06-01 234 gpc_tpc_mask = kcalloc(gr->gpc_nr, sizeof(*gpc_tpc_mask), GFP_KERNEL);
3ffa6f329b6100 Ben Skeggs 2022-06-01 235 gpc_table = kcalloc(gr->tpc_total, sizeof(*gpc_table), GFP_KERNEL);
3ffa6f329b6100 Ben Skeggs 2022-06-01 236 tpc_table = kcalloc(gr->tpc_total, sizeof(*tpc_table), GFP_KERNEL);
3ffa6f329b6100 Ben Skeggs 2022-06-01 237 if (!gpc_table || !tpc_table || !gpc_tpc_mask) {
3ffa6f329b6100 Ben Skeggs 2022-06-01 238 ret = -ENOMEM;
3ffa6f329b6100 Ben Skeggs 2022-06-01 239 goto done;
3ffa6f329b6100 Ben Skeggs 2022-06-01 240 }
3ffa6f329b6100 Ben Skeggs 2022-06-01 241
3ffa6f329b6100 Ben Skeggs 2022-06-01 242 for (gpc = 0; gpc < gr->gpc_nr; gpc++) {
3ffa6f329b6100 Ben Skeggs 2022-06-01 243 for (pes = 0; pes < gr->ppc_nr[gpc]; pes++)
3ffa6f329b6100 Ben Skeggs 2022-06-01 244 gpc_tpc_mask[gpc] |= gr->ppc_tpc_mask[gpc][pes];
3ffa6f329b6100 Ben Skeggs 2022-06-01 245 }
3ffa6f329b6100 Ben Skeggs 2022-06-01 246
3ffa6f329b6100 Ben Skeggs 2022-06-01 247 for (gtpc = 0; gtpc < gr->tpc_total; gtpc++) {
3ffa6f329b6100 Ben Skeggs 2022-06-01 248 for (maxperf = -1, gpc = 0; gpc < gr->gpc_nr; gpc++) {
3ffa6f329b6100 Ben Skeggs 2022-06-01 249 for_each_set_bit(tpc, &gpc_tpc_mask[gpc], gr->tpc_nr[gpc]) {
3ffa6f329b6100 Ben Skeggs 2022-06-01 250 ret = gv100_gr_scg_estimate_perf(gr, gpc_tpc_mask, gpc, tpc, &perf);
3ffa6f329b6100 Ben Skeggs 2022-06-01 251 if (ret)
3ffa6f329b6100 Ben Skeggs 2022-06-01 252 goto done;
3ffa6f329b6100 Ben Skeggs 2022-06-01 253
3ffa6f329b6100 Ben Skeggs 2022-06-01 254 /* nvgpu does ">=" here, but this gets us RM's numbers. */
3ffa6f329b6100 Ben Skeggs 2022-06-01 255 if (perf > maxperf) {
3ffa6f329b6100 Ben Skeggs 2022-06-01 256 maxperf = perf;
3ffa6f329b6100 Ben Skeggs 2022-06-01 257 gpc_table[gtpc] = gpc;
3ffa6f329b6100 Ben Skeggs 2022-06-01 258 tpc_table[gtpc] = tpc;
3ffa6f329b6100 Ben Skeggs 2022-06-01 259 }
3ffa6f329b6100 Ben Skeggs 2022-06-01 260 }
3ffa6f329b6100 Ben Skeggs 2022-06-01 261 }
3ffa6f329b6100 Ben Skeggs 2022-06-01 262
3ffa6f329b6100 Ben Skeggs 2022-06-01 @263 gpc_tpc_mask[gpc_table[gtpc]] &= ~BIT(tpc_table[gtpc]);
3ffa6f329b6100 Ben Skeggs 2022-06-01 264 }
3ffa6f329b6100 Ben Skeggs 2022-06-01 265
3ffa6f329b6100 Ben Skeggs 2022-06-01 266 /*TODO: build table for sm_per_tpc != 1, don't use yet, but might need later? */
3ffa6f329b6100 Ben Skeggs 2022-06-01 267 for (gtpc = 0; gtpc < gr->tpc_total; gtpc++) {
3ffa6f329b6100 Ben Skeggs 2022-06-01 268 gr->sm[gtpc].gpc = gpc_table[gtpc];
3ffa6f329b6100 Ben Skeggs 2022-06-01 269 gr->sm[gtpc].tpc = tpc_table[gtpc];
3ffa6f329b6100 Ben Skeggs 2022-06-01 270 gr->sm_nr++;
3ffa6f329b6100 Ben Skeggs 2022-06-01 271 }
3ffa6f329b6100 Ben Skeggs 2022-06-01 272
3ffa6f329b6100 Ben Skeggs 2022-06-01 273 done:
3ffa6f329b6100 Ben Skeggs 2022-06-01 274 kfree(gpc_table);
3ffa6f329b6100 Ben Skeggs 2022-06-01 275 kfree(tpc_table);
3ffa6f329b6100 Ben Skeggs 2022-06-01 276 kfree(gpc_tpc_mask);
3ffa6f329b6100 Ben Skeggs 2022-06-01 277 return ret;
3ffa6f329b6100 Ben Skeggs 2022-06-01 278 }
3ffa6f329b6100 Ben Skeggs 2022-06-01 279
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
next reply other threads:[~2023-12-03 13:46 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-03 13:46 kernel test robot [this message]
-- strict thread matches above, loose matches on Subject: below --
2025-12-13 3:01 drivers/gpu/drm/nouveau/nvkm/engine/gr/gv100.c:263 gv100_gr_oneinit_sm_id() warn: potentially one past the end of array 'gpc_tpc_mask[gpc_table[gtpc]]' kernel test robot
2022-12-30 21:23 kernel test robot
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=202312032140.sb2aZTLS-lkp@intel.com \
--to=lkp@intel.com \
--cc=error27@gmail.com \
--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 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.