Add limit into sscanf format string for on-stack buffer. Fixes: 0d5936344f30 ("sched: Implement interface for cgroup unified hierarchy") Signed-off-by: Konstantin Khlebnikov <khlebnikov@xxxxxxxxxxxxxx> --- kernel/sched/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 43f44539b88f..3971bc62521d 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -6968,7 +6968,7 @@ static int __maybe_unused cpu_period_quota_parse(char *buf, { char tok[21]; /* U64_MAX */ - if (!sscanf(buf, "%s %llu", tok, periodp)) + if (sscanf(buf, "%20s %llu", tok, periodp) < 1) return -EINVAL; *periodp *= NSEC_PER_USEC;