arm_mpam: Initialize all of struct mon_read in mpam_restore_mbwu_state()

m->err and *m->val may be read before initialization in __ris_msmon_read()
when called from mpam_restore_mbwu_state().

Initialize the whole struct mon_read in mpam_restore_mbwu_state() and fix
the spelling of mbwu in the name.

Fixes: 41e8a14950 ("arm_mpam: Track bandwidth counter state for power management")
Signed-off-by: Ben Horgan <ben.horgan@arm.com>
Tested-by: Gavin Shan <gshan@redhat.com>
Reviewed-by: Gavin Shan <gshan@redhat.com>
Reviewed-by: James Morse <james.morse@arm.com>
Signed-off-by: James Morse <james.morse@arm.com>
This commit is contained in:
Ben Horgan 2026-09-17 15:56:12 +01:00 committed by James Morse
parent d056d29aef
commit 4643335d58

View File

@ -1655,7 +1655,7 @@ static int mpam_restore_mbwu_state(void *_ris)
{
int i;
u64 val;
struct mon_read mwbu_arg;
struct mon_read mbwu_arg;
struct mpam_msc_ris *ris = _ris;
struct msmon_mbwu_state *mbwu_state;
struct mpam_msc *msc = ris->vmsc->msc;
@ -1672,14 +1672,17 @@ static int mpam_restore_mbwu_state(void *_ris)
continue;
}
mwbu_arg.ris = ris;
mwbu_arg.ctx = &mbwu_state->cfg;
mwbu_arg.type = mpam_msmon_choose_counter(class);
mwbu_arg.val = &val;
val = 0;
mbwu_arg = (struct mon_read) {
.ris = ris,
.ctx = &mbwu_state->cfg,
.type = mpam_msmon_choose_counter(class),
.val = &val,
};
mbwu_state->reset_on_next_read = true;
__ris_msmon_read_locked(&mwbu_arg);
__ris_msmon_read_locked(&mbwu_arg);
mpam_mon_sel_unlock(msc);
}