ACK: [PATCH 06/10] cpu: cpufreq: avoid division by zero ob cpu_top_speed

Alex Hung alex.hung at canonical.com
Tue May 6 08:28:11 UTC 2014


On 05/01/2014 10:01 PM, Colin King wrote:
> From: Colin Ian King <colin.king at canonical.com>
>
> Coverity Scan detected a potential division by zero. This is highly
> unlikely, but to be safe, initialize cpu_top_speed to 1 to avoid
> this every happening.
>
> Signed-off-by: Colin Ian King <colin.king at canonical.com>
> ---
>   src/cpu/cpufreq/cpufreq.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/cpu/cpufreq/cpufreq.c b/src/cpu/cpufreq/cpufreq.c
> index 993acb4..cecd083 100644
> --- a/src/cpu/cpufreq/cpufreq.c
> +++ b/src/cpu/cpufreq/cpufreq.c
> @@ -268,7 +268,7 @@ static void do_cpu(fwts_framework *fw, const int cpu)
>   	int i, speedcount;
>   	static int warned = 0;
>   	bool warned_PSS = false;
> -	uint64_t cpu_top_speed = 0;
> +	uint64_t cpu_top_speed = 1;
>   	int claimed_hz_too_low = 0;
>   	int bios_limit_too_low = 0;
>   	const uint32_t claimed_hz = get_claimed_hz(cpu);
>

Acked-by: Alex Hung <alex.hung at canonical.com>



More information about the fwts-devel mailing list