File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change 2
2
/*
3
3
* Auto-group scheduling implementation:
4
4
*/
5
+ #include <linux/nospec.h>
5
6
#include "sched.h"
6
7
7
8
unsigned int __read_mostly sysctl_sched_autogroup_enabled = 1 ;
@@ -209,7 +210,7 @@ int proc_sched_autogroup_set_nice(struct task_struct *p, int nice)
209
210
static unsigned long next = INITIAL_JIFFIES ;
210
211
struct autogroup * ag ;
211
212
unsigned long shares ;
212
- int err ;
213
+ int err , idx ;
213
214
214
215
if (nice < MIN_NICE || nice > MAX_NICE )
215
216
return - EINVAL ;
@@ -227,7 +228,9 @@ int proc_sched_autogroup_set_nice(struct task_struct *p, int nice)
227
228
228
229
next = HZ / 10 + jiffies ;
229
230
ag = autogroup_task_get (p );
230
- shares = scale_load (sched_prio_to_weight [nice + 20 ]);
231
+
232
+ idx = array_index_nospec (nice + 20 , 40 );
233
+ shares = scale_load (sched_prio_to_weight [idx ]);
231
234
232
235
down_write (& ag -> lock );
233
236
err = sched_group_set_shares (ag -> tg , shares );
You can’t perform that action at this time.
0 commit comments