summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@localhost>2020-09-04 01:47:52 -0700
committerGerrit - the friendly Code Review server <code-review@localhost>2020-09-04 01:47:51 -0700
commit555c6a048e537bcf7c9b40a93dfbee762503c7d2 (patch)
treeb8714167d4e417c7205c3bf5ad12dbc177735da6 /kernel
parent902704b356fbfd8b6c19c04d0b3122dfbf3e78d8 (diff)
parenta3d56a7137f68e935e03e6a763c8113fc699af2b (diff)
Merge "sched: Fix out of bounds issue in for_each_cluster macro"
Diffstat (limited to 'kernel')
-rw-r--r--kernel/sched/core_ctl.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/kernel/sched/core_ctl.c b/kernel/sched/core_ctl.c
index ce15ae7fe76b..70cd0649ac9b 100644
--- a/kernel/sched/core_ctl.c
+++ b/kernel/sched/core_ctl.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2014-2017, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2014-2017, 2020 The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@@ -70,8 +70,8 @@ static struct cluster_data cluster_state[MAX_CLUSTERS];
static unsigned int num_clusters;
#define for_each_cluster(cluster, idx) \
- for ((cluster) = &cluster_state[idx]; (idx) < num_clusters;\
- (idx)++, (cluster) = &cluster_state[idx])
+ for (; (idx) < num_clusters && ((cluster) = &cluster_state[idx]);\
+ (idx)++)
static DEFINE_SPINLOCK(state_lock);
static void apply_need(struct cluster_data *state);