diff options
| author | Greg Kroah-Hartman <[email protected]> | 2021-10-04 09:16:43 +0200 |
|---|---|---|
| committer | Greg Kroah-Hartman <[email protected]> | 2021-10-04 09:16:43 +0200 |
| commit | 8bf7a12c628d1cad59cd8057171dd3ef95f0857a (patch) | |
| tree | 31bd590f6dfb61e351be19bfcbc636e8b30ecce3 /kernel/sched/debug.c | |
| parent | 20ac422c8ef753ae0da0c9312443b03c37cfbb5b (diff) | |
| parent | 9e1ff307c779ce1f0f810c7ecce3d95bbae40896 (diff) | |
Merge 5.15-rc4 into char-misc-next
We need the char-misc fixes in here as well.
Signed-off-by: Greg Kroah-Hartman <[email protected]>
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; |