summaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorReinette Chatre <reinette.chatre@intel.com>2018-09-15 14:58:25 -0700
committerThomas Gleixner <tglx@linutronix.de>2018-09-18 23:38:06 +0200
commitf0df4e1acf3d721958dcafb2c9c0bdf25189068d (patch)
tree27b89ed1ccaa20f4ee7cfca3313fd83250af3d0c /arch
parent32d736abed4febff4b6bf85d5d240ee24d254322 (diff)
downloadlinux-stable-f0df4e1acf3d721958dcafb2c9c0bdf25189068d.tar.gz
linux-stable-f0df4e1acf3d721958dcafb2c9c0bdf25189068d.tar.bz2
linux-stable-f0df4e1acf3d721958dcafb2c9c0bdf25189068d.zip
x86/intel_rdt: Fix incorrect loop end condition
A loop is used to check if a CAT resource's CBM of one CLOSID overlaps with the CBM of another CLOSID of the same resource. The loop is run over all CLOSIDs supported by the resource. The problem with running the loop over all CLOSIDs supported by the resource is that its number of supported CLOSIDs may be more than the number of supported CLOSIDs on the system, which is the minimum number of CLOSIDs supported across all resources. Fix the loop to only consider the number of system supported CLOSIDs, not all that are supported by the resource. Fixes: 49f7b4efa ("x86/intel_rdt: Enable setting of exclusive mode") Signed-off-by: Reinette Chatre <reinette.chatre@intel.com> Signed-off-by: Fenghua Yu <fenghua.yu@intel.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Cc: "H Peter Anvin" <hpa@zytor.com> Cc: "Tony Luck" <tony.luck@intel.com> Cc: "Xiaochen Shen" <xiaochen.shen@intel.com> Cc: "Chen Yu" <yu.c.chen@intel.com> Link: https://lkml.kernel.org/r/1537048707-76280-8-git-send-email-fenghua.yu@intel.com
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/kernel/cpu/intel_rdt_rdtgroup.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c b/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c
index 74821bc457c0..afd93d45e21b 100644
--- a/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c
+++ b/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c
@@ -996,7 +996,7 @@ bool rdtgroup_cbm_overlaps(struct rdt_resource *r, struct rdt_domain *d,
/* Check for overlap with other resource groups */
ctrl = d->ctrl_val;
- for (i = 0; i < r->num_closid; i++, ctrl++) {
+ for (i = 0; i < closids_supported(); i++, ctrl++) {
ctrl_b = (unsigned long *)ctrl;
mode = rdtgroup_mode_by_closid(i);
if (closid_allocated(i) && i != closid &&