drivers/perf/dwc_pcie_pmu.c:418 dwc_pcie_pmu_validate_group() error: uninitialized symbol 'time_event'.
Dan Carpenter
build botBCC: [email protected]
CC: [email protected]
CC: [email protected]
TO: Ilkka Koskinen <[email protected]>
CC: Will Deacon <[email protected]>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-next/perf head: 6d2f913fda5683fbd4c3580262e10386c1263dfb commit: 71396cfac97d0249fa7d8dcc8e649b6ba4c090e4 [5/28] perf/dwc_pcie: Support counting multiple lane events in parallel
:::::: branch date: 16 hours ago
:::::: commit date: 5 days ago
config: sparc64-randconfig-r072-20250922 (https://download.01.org/0day-ci/archive/20250923/[email protected]/config)
compiler: sparc64-linux-gcc (GCC) 12.5.0
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 <[email protected]> | Reported-by: Dan Carpenter <[email protected]> | Closes: https://lore.kernel.org/r/[email protected]/
smatch warnings:drivers/perf/dwc_pcie_pmu.c:418 dwc_pcie_pmu_validate_group() error: uninitialized symbol 'time_event'.
vim +/time_event +418 drivers/perf/dwc_pcie_pmu.c
71396cfac97d02 Ilkka Koskinen 2025-08-28 400
71396cfac97d02 Ilkka Koskinen 2025-08-28 401 static int dwc_pcie_pmu_validate_group(struct perf_event *event)
71396cfac97d02 Ilkka Koskinen 2025-08-28 402 {
71396cfac97d02 Ilkka Koskinen 2025-08-28 403 struct perf_event *sibling, *leader = event->group_leader;
71396cfac97d02 Ilkka Koskinen 2025-08-28 404 DECLARE_BITMAP(val_lane_events, 2 * DWC_PCIE_LANE_MAX_EVENTS_PER_GROUP);
71396cfac97d02 Ilkka Koskinen 2025-08-28 405 bool time_event;
71396cfac97d02 Ilkka Koskinen 2025-08-28 406 int type;
71396cfac97d02 Ilkka Koskinen 2025-08-28 407
71396cfac97d02 Ilkka Koskinen 2025-08-28 408 type = DWC_PCIE_EVENT_TYPE(leader);
71396cfac97d02 Ilkka Koskinen 2025-08-28 409 if (type == DWC_PCIE_TIME_BASE_EVENT)
71396cfac97d02 Ilkka Koskinen 2025-08-28 410 time_event = true;
71396cfac97d02 Ilkka Koskinen 2025-08-28 411 else
71396cfac97d02 Ilkka Koskinen 2025-08-28 412 if (dwc_pcie_pmu_validate_add_lane_event(leader, val_lane_events))
71396cfac97d02 Ilkka Koskinen 2025-08-28 413 return -ENOSPC;
71396cfac97d02 Ilkka Koskinen 2025-08-28 414
71396cfac97d02 Ilkka Koskinen 2025-08-28 415 for_each_sibling_event(sibling, leader) {
71396cfac97d02 Ilkka Koskinen 2025-08-28 416 type = DWC_PCIE_EVENT_TYPE(sibling);
71396cfac97d02 Ilkka Koskinen 2025-08-28 417 if (type == DWC_PCIE_TIME_BASE_EVENT) {
71396cfac97d02 Ilkka Koskinen 2025-08-28 @418 if (time_event)
71396cfac97d02 Ilkka Koskinen 2025-08-28 419 return -ENOSPC;
71396cfac97d02 Ilkka Koskinen 2025-08-28 420
71396cfac97d02 Ilkka Koskinen 2025-08-28 421 time_event = true;
71396cfac97d02 Ilkka Koskinen 2025-08-28 422 continue;
71396cfac97d02 Ilkka Koskinen 2025-08-28 423 }
71396cfac97d02 Ilkka Koskinen 2025-08-28 424
71396cfac97d02 Ilkka Koskinen 2025-08-28 425 if (dwc_pcie_pmu_validate_add_lane_event(sibling, val_lane_events))
71396cfac97d02 Ilkka Koskinen 2025-08-28 426 return -ENOSPC;
71396cfac97d02 Ilkka Koskinen 2025-08-28 427 }
71396cfac97d02 Ilkka Koskinen 2025-08-28 428
71396cfac97d02 Ilkka Koskinen 2025-08-28 429 return 0;
71396cfac97d02 Ilkka Koskinen 2025-08-28 430 }
71396cfac97d02 Ilkka Koskinen 2025-08-28 431 Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
Hi Will,
That's cleary a bug and I don't know how I missed it.
I can submit a new version or a separate patch to fix it in the morning. Which one do you prefer?
Cheers, Ilkka
Quoted 58 lines · Dan Carpenter
tree: https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-next/perf head: 6d2f913fda5683fbd4c3580262e10386c1263dfb commit: 71396cfac97d0249fa7d8dcc8e649b6ba4c090e4 [5/28] perf/dwc_pcie: Support counting multiple lane events in parallel config: sparc64-randconfig-r072-20250922 (https://download.01.org/0day-ci/archive/20250923/[email protected]/config) compiler: sparc64-linux-gcc (GCC) 12.5.0If 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 <[email protected]> | Reported-by: Dan Carpenter <[email protected]> | Closes: https://lore.kernel.org/r/[email protected]/smatch warnings:
drivers/perf/dwc_pcie_pmu.c:418dwc_pcie_pmu_validate_group()error: uninitialized symbol 'time_event'.vim +/time_event +418
drivers/perf/dwc_pcie_pmu.c71396cfac97d02 Ilkka Koskinen 2025-08-28 401 static int dwc_pcie_pmu_validate_group(struct perf_event *event) 71396cfac97d02 Ilkka Koskinen 2025-08-28 402 { 71396cfac97d02 Ilkka Koskinen 2025-08-28 403 struct perf_event *sibling, *leader = event->group_leader; 71396cfac97d02 Ilkka Koskinen 2025-08-28 404 DECLARE_BITMAP(val_lane_events, 2 * DWC_PCIE_LANE_MAX_EVENTS_PER_GROUP); 71396cfac97d02 Ilkka Koskinen 2025-08-28 405 bool time_event; 71396cfac97d02 Ilkka Koskinen 2025-08-28 406 int type; 71396cfac97d02 Ilkka Koskinen 2025-08-28 407 71396cfac97d02 Ilkka Koskinen 2025-08-28 408 type = DWC_PCIE_EVENT_TYPE(leader); 71396cfac97d02 Ilkka Koskinen 2025-08-28 409 if (type == DWC_PCIE_TIME_BASE_EVENT) 71396cfac97d02 Ilkka Koskinen 2025-08-28 410 time_event = true; 71396cfac97d02 Ilkka Koskinen 2025-08-28 411 else 71396cfac97d02 Ilkka Koskinen 2025-08-28 412 if (dwc_pcie_pmu_validate_add_lane_event(leader, val_lane_events)) 71396cfac97d02 Ilkka Koskinen 2025-08-28 413 return -ENOSPC; 71396cfac97d02 Ilkka Koskinen 2025-08-28 414 71396cfac97d02 Ilkka Koskinen 2025-08-28 415 for_each_sibling_event(sibling, leader) { 71396cfac97d02 Ilkka Koskinen 2025-08-28 416 type = DWC_PCIE_EVENT_TYPE(sibling); 71396cfac97d02 Ilkka Koskinen 2025-08-28 417 if (type == DWC_PCIE_TIME_BASE_EVENT) {
71396cfac97d02Ilkka Koskinen 2025-08-28 @418 if (time_event)
time_eventis never set to false. I really encourage developers to useCONFIG_INIT_STACK_ALL_PATTERN=yfor testing. (UseCONFIG_INIT_STACK_ALL_ZEROfor production obviously).71396cfac97d02 Ilkka Koskinen 2025-08-28 419 return -ENOSPC; 71396cfac97d02 Ilkka Koskinen 2025-08-28 420 71396cfac97d02 Ilkka Koskinen 2025-08-28 421 time_event = true; 71396cfac97d02 Ilkka Koskinen 2025-08-28 422 continue; 71396cfac97d02 Ilkka Koskinen 2025-08-28 423 } 71396cfac97d02 Ilkka Koskinen 2025-08-28 424 71396cfac97d02 Ilkka Koskinen 2025-08-28 425 if (dwc_pcie_pmu_validate_add_lane_event(sibling, val_lane_events)) 71396cfac97d02 Ilkka Koskinen 2025-08-28 426 return -ENOSPC; 71396cfac97d02 Ilkka Koskinen 2025-08-28 427 } 71396cfac97d02 Ilkka Koskinen 2025-08-28 428 71396cfac97d02 Ilkka Koskinen 2025-08-28 429 return 0; 71396cfac97d02 Ilkka Koskinen 2025-08-28 430 }Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
Quoted 5 lines · Ilkka Koskinen
Hi Will,
That's cleary a bug and I don't know how I missed it.
Because we disabled uninitialized variable warnings for GCC and because everyone has CONFIG_INIT_STACK_ALL_ZERO set so it wouldn't show up in testing either.
regards,
dan carpenter
Quoted 6 lines · Dan Carpenter
Quoted 1 line · Ilkka Koskinen
That's cleary a bug and I don't know how I missed it.
Because we disabled uninitialized variable warnings for GCC and because everyone has
CONFIG_INIT_STACK_ALL_ZEROset so it wouldn't show up in testing either.
The more annoying thing is that I run smatch on my tree before pushing but somehow I didn't notice this. I'll run it again to see whether it detected it in the first place...
Will
Quoted 11 lines · Will Deacon
Quoted 6 lines · Dan Carpenter
Quoted 1 line · Ilkka Koskinen
That's cleary a bug and I don't know how I missed it.
Because we disabled uninitialized variable warnings for GCC and because everyone has
CONFIG_INIT_STACK_ALL_ZEROset so it wouldn't show up in testing either.The more annoying thing is that I run smatch on my tree before pushing but somehow I didn't notice this. I'll run it again to see whether it detected it in the first place...
bah, there it is:
+drivers/perf/dwc_pcie_pmu.c:418 dwc_pcie_pmu_validate_group() error: uninitialized symbol 'time_event'. [smatch]
so not sure why I missed this. Maybe I used the wrong .config (this driver isn't enabled in defconfig).
Will
Quoted 13 lines · Will Deacon
Quoted 11 lines · Will Deacon
Quoted 6 lines · Dan Carpenter
Quoted 1 line · Ilkka Koskinen
That's cleary a bug and I don't know how I missed it.
Because we disabled uninitialized variable warnings for GCC and because everyone has
CONFIG_INIT_STACK_ALL_ZEROset so it wouldn't show up in testing either.The more annoying thing is that I run smatch on my tree before pushing but somehow I didn't notice this. I'll run it again to see whether it detected it in the first place...
Quoted 8 lines
bah, there it is:
+drivers/perf/dwc_pcie_pmu.c:418dwc_pcie_pmu_validate_group()error: uninitialized symbol 'time_event'. [smatch]so not sure why I missed this. Maybe I used the wrong .config (this driver isn't enabled in defconfig).
Will
Interestingly, the gcc version I was using to doesn't raise a warning even if I have -Wmaybe-initialized set. It does warn though if I move the if line outside the loop.
Anyways, I'm glad Dan and the test bot caught the bug.
Cheers, Ilkka
Quoted 1 line · Ilkka Koskinen
That's cleary a bug and I don't know how I missed it.
Don't worry, these things happen. As Dan pointed out, it's hard to catch this in practice anyway (and the robot is doing its job for us).
Quoted 2 lines
I can submit a new version or a separate patch to fix it in the morning. Which one do you prefer?
Please just send fixes on top of for-next/perf, as that is a non-rebasing branch.
Will