From: Bowen Yu Date: Mon, 19 May 2025 07:09:08 +0000 (+0800) Subject: cpufreq: Replace magic number X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=9c5075fc9d322670d4a82881bf41922a90fe423a;p=users%2Fjedix%2Flinux-maple.git cpufreq: Replace magic number Setting the length of str_governor with a magic number could cause overflow when max length increases, it is better to use the defined macro in this case. Signed-off-by: Bowen Yu Acked-by: Viresh Kumar Link: https://patch.msgid.link/20250519070908.930879-1-yubowen8@huawei.com Signed-off-by: Rafael J. Wysocki --- diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index cb475ac5b618..fbd09c0845ff 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -806,7 +806,7 @@ static ssize_t show_scaling_governor(struct cpufreq_policy *policy, char *buf) static ssize_t store_scaling_governor(struct cpufreq_policy *policy, const char *buf, size_t count) { - char str_governor[16]; + char str_governor[CPUFREQ_NAME_LEN]; int ret; ret = sscanf(buf, "%15s", str_governor);