We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b5bf9a9 commit 7281c8dCopy full SHA for 7281c8d
kernel/sched/core.c
@@ -8,6 +8,7 @@
8
#include "sched.h"
9
10
#include <linux/kthread.h>
11
+#include <linux/nospec.h>
12
13
#include <asm/switch_to.h>
14
#include <asm/tlb.h>
@@ -6923,11 +6924,15 @@ static int cpu_weight_nice_write_s64(struct cgroup_subsys_state *css,
6923
6924
struct cftype *cft, s64 nice)
6925
{
6926
unsigned long weight;
6927
+ int idx;
6928
6929
if (nice < MIN_NICE || nice > MAX_NICE)
6930
return -ERANGE;
6931
- weight = sched_prio_to_weight[NICE_TO_PRIO(nice) - MAX_RT_PRIO];
6932
+ idx = NICE_TO_PRIO(nice) - MAX_RT_PRIO;
6933
+ idx = array_index_nospec(idx, 40);
6934
+ weight = sched_prio_to_weight[idx];
6935
+
6936
return sched_group_set_shares(css_tg(css), scale_load(weight));
6937
}
6938
#endif
0 commit comments