]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
cpufreq: Replace magic number
authorBowen Yu <yubowen8@huawei.com>
Mon, 19 May 2025 07:09:08 +0000 (15:09 +0800)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Wed, 21 May 2025 20:19:10 +0000 (22:19 +0200)
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 <yubowen8@huawei.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Link: https://patch.msgid.link/20250519070908.930879-1-yubowen8@huawei.com
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/cpufreq/cpufreq.c

index cb475ac5b618e1d57b5944fa634c273eeda08052..fbd09c0845ff7fa48ccfca2090cfcf432ccb4840 100644 (file)
@@ -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);