drivers/resctrl/mpam_devices.c:1112 __ris_msmon_read() error: uninitialized symbol 'overflow'.

From: Dan Carpenter
Date: Wed Dec 10 2025 - 02:04:38 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: cb015814f8b6eebcbb8e46e111d108892c5e6821
commit: 9e5afb7c32830bcd123976a7729ef4e2dff0cd77 arm_mpam: Use long MBWU counters if supported
config: arm64-randconfig-r072-20251208 (https://download.01.org/0day-ci/archive/20251210/202512100547.N7QPYgfb-lkp@xxxxxxxxx/config)
compiler: clang version 22.0.0git (https://github.com/llvm/llvm-project a805147ac1ba123916de182babb0831fbb148756)

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@xxxxxxxxx>
| Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
| Closes: https://lore.kernel.org/r/202512100547.N7QPYgfb-lkp@xxxxxxxxx/

New smatch warnings:
drivers/resctrl/mpam_devices.c:1112 __ris_msmon_read() error: uninitialized symbol 'overflow'.

vim +/overflow +1112 drivers/resctrl/mpam_devices.c

823e7c3712c584 James Morse 2025-11-19 1070 static void __ris_msmon_read(void *arg)
823e7c3712c584 James Morse 2025-11-19 1071 {
823e7c3712c584 James Morse 2025-11-19 1072 u64 now;
823e7c3712c584 James Morse 2025-11-19 1073 bool nrdy = false;
823e7c3712c584 James Morse 2025-11-19 1074 bool config_mismatch;
b35363793291e3 Ben Horgan 2025-11-19 1075 bool overflow;
823e7c3712c584 James Morse 2025-11-19 1076 struct mon_read *m = arg;
823e7c3712c584 James Morse 2025-11-19 1077 struct mon_cfg *ctx = m->ctx;
823e7c3712c584 James Morse 2025-11-19 1078 struct mpam_msc_ris *ris = m->ris;
41e8a14950e173 James Morse 2025-11-19 1079 struct msmon_mbwu_state *mbwu_state;
823e7c3712c584 James Morse 2025-11-19 1080 struct mpam_props *rprops = &ris->props;
823e7c3712c584 James Morse 2025-11-19 1081 struct mpam_msc *msc = m->ris->vmsc->msc;
823e7c3712c584 James Morse 2025-11-19 1082 u32 mon_sel, ctl_val, flt_val, cur_ctl, cur_flt;
823e7c3712c584 James Morse 2025-11-19 1083
823e7c3712c584 James Morse 2025-11-19 1084 if (!mpam_mon_sel_lock(msc)) {
823e7c3712c584 James Morse 2025-11-19 1085 m->err = -EIO;
823e7c3712c584 James Morse 2025-11-19 1086 return;
823e7c3712c584 James Morse 2025-11-19 1087 }
823e7c3712c584 James Morse 2025-11-19 1088 mon_sel = FIELD_PREP(MSMON_CFG_MON_SEL_MON_SEL, ctx->mon) |
823e7c3712c584 James Morse 2025-11-19 1089 FIELD_PREP(MSMON_CFG_MON_SEL_RIS, ris->ris_idx);
823e7c3712c584 James Morse 2025-11-19 1090 mpam_write_monsel_reg(msc, CFG_MON_SEL, mon_sel);
823e7c3712c584 James Morse 2025-11-19 1091
823e7c3712c584 James Morse 2025-11-19 1092 /*
823e7c3712c584 James Morse 2025-11-19 1093 * Read the existing configuration to avoid re-writing the same values.
823e7c3712c584 James Morse 2025-11-19 1094 * This saves waiting for 'nrdy' on subsequent reads.
823e7c3712c584 James Morse 2025-11-19 1095 */
823e7c3712c584 James Morse 2025-11-19 1096 read_msmon_ctl_flt_vals(m, &cur_ctl, &cur_flt);
9e5afb7c32830b Rohit Mathew 2025-11-19 1097
9e5afb7c32830b Rohit Mathew 2025-11-19 1098 if (mpam_feat_msmon_mbwu_31counter == m->type)
b35363793291e3 Ben Horgan 2025-11-19 1099 overflow = cur_ctl & MSMON_CFG_x_CTL_OFLOW_STATUS;
9e5afb7c32830b Rohit Mathew 2025-11-19 1100 else if (mpam_feat_msmon_mbwu_44counter == m->type ||
9e5afb7c32830b Rohit Mathew 2025-11-19 1101 mpam_feat_msmon_mbwu_63counter == m->type)
9e5afb7c32830b Rohit Mathew 2025-11-19 1102 overflow = cur_ctl & MSMON_CFG_MBWU_CTL_OFLOW_STATUS_L;

overflow not initialized on else path, but I haven't looked at how
&cur_flt is set in read_msmon_ctl_flt_vals() so this could be a
false positive.

b35363793291e3 Ben Horgan 2025-11-19 1103
823e7c3712c584 James Morse 2025-11-19 1104 clean_msmon_ctl_val(&cur_ctl);
823e7c3712c584 James Morse 2025-11-19 1105 gen_msmon_ctl_flt_vals(m, &ctl_val, &flt_val);
823e7c3712c584 James Morse 2025-11-19 1106 config_mismatch = cur_flt != flt_val ||
823e7c3712c584 James Morse 2025-11-19 1107 cur_ctl != (ctl_val | MSMON_CFG_x_CTL_EN);
823e7c3712c584 James Morse 2025-11-19 1108
b35363793291e3 Ben Horgan 2025-11-19 1109 if (config_mismatch) {
823e7c3712c584 James Morse 2025-11-19 1110 write_msmon_ctl_flt_vals(m, ctl_val, flt_val);
b35363793291e3 Ben Horgan 2025-11-19 1111 overflow = false;
b35363793291e3 Ben Horgan 2025-11-19 @1112 } else if (overflow) {
^^^^^^^^
here.

b35363793291e3 Ben Horgan 2025-11-19 1113 mpam_write_monsel_reg(msc, CFG_MBWU_CTL,
9e5afb7c32830b Rohit Mathew 2025-11-19 1114 cur_ctl &
9e5afb7c32830b Rohit Mathew 2025-11-19 1115 ~(MSMON_CFG_x_CTL_OFLOW_STATUS |
9e5afb7c32830b Rohit Mathew 2025-11-19 1116 MSMON_CFG_MBWU_CTL_OFLOW_STATUS_L));
b35363793291e3 Ben Horgan 2025-11-19 1117 }
823e7c3712c584 James Morse 2025-11-19 1118
823e7c3712c584 James Morse 2025-11-19 1119 switch (m->type) {
823e7c3712c584 James Morse 2025-11-19 1120 case mpam_feat_msmon_csu:

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