lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 3 Nov 2022 14:30:10 +0000
From:   "Colin King (gmail)" <colin.i.king@...il.com>
To:     Joe Perches <joe@...ches.com>,
        "Rafael J . Wysocki" <rafael@...nel.org>,
        Viresh Kumar <viresh.kumar@...aro.org>,
        linux-pm@...r.kernel.org
Cc:     kernel-janitors@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] cpufreq: longhaul: Make array speeds static const

On 03/11/2022 14:15, Joe Perches wrote:
> On Thu, 2022-11-03 at 13:21 +0000, Colin Ian King wrote:
>> Don't populate the read-only array speeds on the stack but instead
>> make it static. Also makes the object code a little smaller.
> []
>> diff --git a/drivers/cpufreq/longhaul.c b/drivers/cpufreq/longhaul.c
> []
>> @@ -407,7 +407,7 @@ static int guess_fsb(int mult)
>>   {
>>   	int speed = cpu_khz / 1000;
>>   	int i;
>> -	int speeds[] = { 666, 1000, 1333, 2000 };
>> +	static const int speeds[] = { 666, 1000, 1333, 2000 };
>>   	int f_max, f_min;
>>   
>>   	for (i = 0; i < 4; i++) {
> 
> style trivia:  the loop test is probably better using ARRAY_SIZE
> 
> 	for (i = 0; i < ARRAY_SIZE(speeds); i++)
> 
I'll send a V2 for that. Good idea.

Colin

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ