Re: [arm64:for-next/perf 5/28] drivers/perf/dwc_pcie_pmu.c:418 dwc_pcie_pmu_validate_group() error: uninitialized symbol 'time_event'.

Ilkka Koskinen
2025-09-23T07:55:25Z

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

On Tue, 23 Sep 2025, Dan Carpenter wrote:
> 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/202509231223.gZsX6Eio-lkp@intel.com/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 <lkp@intel.com>
> | Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
> | Closes: https://lore.kernel.org/r/202509231223.gZsX6Eio-lkp@intel.com/
>
> 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 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)
>
> time_event is never set to false. I really encourage developers to
> use CONFIG_INIT_STACK_ALL_PATTERN=y for testing. (Use
> CONFIG_INIT_STACK_ALL_ZERO for 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 }
>
> --
> 0-DAY CI Kernel Test Service
> https://github.com/intel/lkp-tests/wiki
>
>