Merge branch 'pm-cpufreq'
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 20 Oct 2016 21:24:58 +0000 (23:24 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 20 Oct 2016 21:24:58 +0000 (23:24 +0200)
* pm-cpufreq:
  cpufreq: fix overflow in cpufreq_table_find_index_dl()

include/linux/cpufreq.h

index 5fa55fc56e18d1971da8c2e031c35a17fe0d51fc..32dc0cbd51ca3729bef594f7a84832bc6389e3ea 100644 (file)
@@ -677,10 +677,10 @@ static inline int cpufreq_table_find_index_dl(struct cpufreq_policy *policy,
                if (best == table - 1)
                        return pos - table;
 
-               return best - pos;
+               return best - table;
        }
 
-       return best - pos;
+       return best - table;
 }
 
 /* Works only on sorted freq-tables */