diff options
| author | Jonathan Corbet <corbet@lwn.net> | 2021-10-04 16:44:16 -0600 |
|---|---|---|
| committer | Jonathan Corbet <corbet@lwn.net> | 2021-10-04 16:44:16 -0600 |
| commit | b718f9d919d16fb7b97a890f74d34593d9cecd20 (patch) | |
| tree | ed38d58283ae36e0478bac2e0d244e06dbcc2f1c /kernel/sched/debug.c | |
| parent | 250a0a5ba9d2cfbdb7c77b421ff1e03d630bea46 (diff) | |
| parent | 9e1ff307c779ce1f0f810c7ecce3d95bbae40896 (diff) | |
Merge tag 'v5.15-rc4' into docs-next
This is needed to get a docs fix that entered via the DRM tree; testers
have requested it so that PDF builds in docs-next work again.
Diffstat (limited to 'kernel/sched/debug.c')
| -rw-r--r-- | kernel/sched/debug.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c index 49716228efb4..17a653b67006 100644 --- a/kernel/sched/debug.c +++ b/kernel/sched/debug.c @@ -173,16 +173,22 @@ static ssize_t sched_scaling_write(struct file *filp, const char __user *ubuf, size_t cnt, loff_t *ppos) { char buf[16]; + unsigned int scaling; if (cnt > 15) cnt = 15; if (copy_from_user(&buf, ubuf, cnt)) return -EFAULT; + buf[cnt] = '\0'; - if (kstrtouint(buf, 10, &sysctl_sched_tunable_scaling)) + if (kstrtouint(buf, 10, &scaling)) return -EINVAL; + if (scaling >= SCHED_TUNABLESCALING_END) + return -EINVAL; + + sysctl_sched_tunable_scaling = scaling; if (sched_update_scaling()) return -EINVAL; |
