]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
arm_mpam: resctrl: Fix the check for no monitor components found
authorBen Horgan <ben.horgan@arm.com>
Tue, 14 Apr 2026 13:27:56 +0000 (14:27 +0100)
committerJames Morse <james.morse@arm.com>
Fri, 17 Apr 2026 16:48:07 +0000 (17:48 +0100)
Dan Carpenter reports that, in mpam_resctrl_alloc_domain(), any_mon_comp is
used in an 'if' condition when it may be uninitialized. Initialize it to
NULL so that the check behaves correctly when no monitor components are
found.

Reported-by: Dan Carpenter <error27@gmail.com>
Fixes: 264c285999fc ("arm_mpam: resctrl: Add monitor initialisation and domain boilerplate")
Signed-off-by: Ben Horgan <ben.horgan@arm.com>
Reviewed-by: Gavin Shan <gshan@redhat.com>
Signed-off-by: James Morse <james.morse@arm.com>
drivers/resctrl/mpam_resctrl.c

index 4205fb2ee312bf710d75acebbb86b3ad56d7e9e9..1b0b37da12afc134cf8f5d379a1e767d0c79c690 100644 (file)
@@ -1407,7 +1407,7 @@ mpam_resctrl_alloc_domain(unsigned int cpu, struct mpam_resctrl_res *res)
        }
 
        if (r->mon_capable) {
-               struct mpam_component *any_mon_comp;
+               struct mpam_component *any_mon_comp = NULL;
                struct mpam_resctrl_mon *mon;
                enum resctrl_event_id eventid;