From: Tim Deegan <tim@xen.org>
To: xen-devel@lists.xen.org
Cc: Liu Jinsong <jinsong.liu@intel.com>, Jan Beulich <jbeulich@suse.com>
Subject: [PATCH 5/9] cpufreq: avoid integer overflows.
Date: Thu, 12 Sep 2013 13:15:26 +0100 [thread overview]
Message-ID: <1378988130-24172-6-git-send-email-tim@xen.org> (raw)
In-Reply-To: <1378988130-24172-1-git-send-email-tim@xen.org>
The def_sampling_rate() one is, I think, a real bug. The others were
spotted at the same time and are probably not bugs until we start
dealing with 40GHz CPus.
Coverity CID 1055682
Coverity CID 1055683
Signed-off-by: Tim Deegan <tim@xen.org>
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Liu Jinsong <jinsong.liu@intel.com>
---
xen/drivers/cpufreq/cpufreq_ondemand.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/xen/drivers/cpufreq/cpufreq_ondemand.c b/xen/drivers/cpufreq/cpufreq_ondemand.c
index b3f9ab8..7fdba03 100644
--- a/xen/drivers/cpufreq/cpufreq_ondemand.c
+++ b/xen/drivers/cpufreq/cpufreq_ondemand.c
@@ -144,7 +144,7 @@ static void dbs_check_cpu(struct cpu_dbs_info_s *this_dbs_info)
}
/* Check for frequency increase */
- if (max_load_freq > dbs_tuners_ins.up_threshold * policy->cur) {
+ if (max_load_freq > (uint64_t) dbs_tuners_ins.up_threshold * policy->cur) {
/* if we are already at full speed then break out early */
if (policy->cur == max)
return;
@@ -162,7 +162,8 @@ static void dbs_check_cpu(struct cpu_dbs_info_s *this_dbs_info)
* can support the current CPU usage without triggering the up
* policy. To be safe, we focus 10 points under the threshold.
*/
- if (max_load_freq < (dbs_tuners_ins.up_threshold - 10) * policy->cur) {
+ if (max_load_freq
+ < (uint64_t) (dbs_tuners_ins.up_threshold - 10) * policy->cur) {
uint64_t freq_next;
freq_next = max_load_freq / (dbs_tuners_ins.up_threshold - 10);
@@ -246,7 +247,7 @@ int cpufreq_governor_dbs(struct cpufreq_policy *policy, unsigned int event)
* is used for first time
*/
if ((dbs_enable == 1) && !dbs_tuners_ins.sampling_rate) {
- def_sampling_rate = policy->cpuinfo.transition_latency *
+ def_sampling_rate = (uint64_t) policy->cpuinfo.transition_latency *
DEF_SAMPLING_RATE_LATENCY_MULTIPLIER;
if (def_sampling_rate < MIN_STAT_SAMPLING_RATE)
--
1.7.10.4
next prev parent reply other threads:[~2013-09-12 12:15 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-12 12:15 More Coverity-reported issues Tim Deegan
2013-09-12 12:15 ` [PATCH 1/9] x86/mm: Don't dereference p2m pointer before NULL check Tim Deegan
2013-09-12 12:15 ` [PATCH 2/9] passthrough/amd: Drop unnecessary lock lookup Tim Deegan
2013-09-12 13:35 ` Jan Beulich
2013-09-12 12:15 ` [PATCH 3/9] passthrough/amd: Missing 'break' Tim Deegan
2013-09-17 15:04 ` Suravee Suthikulpanit
2013-09-12 12:15 ` [PATCH 4/9] passthrough/amd: Shuffle declaration Tim Deegan
2013-09-12 13:38 ` Jan Beulich
2013-09-12 13:44 ` Tim Deegan
2013-09-12 14:03 ` Jan Beulich
2013-09-17 15:19 ` Suravee Suthikulpanit
2013-09-12 12:15 ` Tim Deegan [this message]
2013-09-12 13:49 ` [PATCH 5/9] cpufreq: avoid integer overflows Jan Beulich
2013-09-13 7:18 ` Liu, Jinsong
2013-09-12 12:15 ` [PATCH 6/9] cpufreq: missing check of copy_from_guest() Tim Deegan
2013-09-12 13:54 ` Jan Beulich
2013-09-13 7:18 ` Liu, Jinsong
2013-09-12 12:15 ` [PATCH 7/9] ehci-dbgp: avoid division by zero Tim Deegan
2013-09-12 13:55 ` Jan Beulich
2013-09-12 12:15 ` [PATCH 8/9] ehci-dbgp: drop dead code Tim Deegan
2013-09-12 14:01 ` Jan Beulich
2013-09-12 12:15 ` [PATCH 9/9] acpi/pmstat: fix check for empty name strings Tim Deegan
2013-09-12 14:02 ` Jan Beulich
2013-09-12 13:11 ` More Coverity-reported issues Andrew Cooper
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1378988130-24172-6-git-send-email-tim@xen.org \
--to=tim@xen.org \
--cc=jbeulich@suse.com \
--cc=jinsong.liu@intel.com \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).