aboutsummaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2020-11-17 16:41:47 +0000
committerPeter Maydell <peter.maydell@linaro.org>2020-11-17 16:41:47 +0000
commitc446ac37b7e79d971e55b3423981ada0c3db6459 (patch)
treef53b8231f446fee6d4d446ce00281113932ee4e2 /util
parentc8e5c4b246584da36694a3c259a7dbb8a7e7b1f3 (diff)
parentab135622cf478585bdfcb68b85e4a817d74a0c42 (diff)
downloadqemu-c446ac37b7e79d971e55b3423981ada0c3db6459.zip
qemu-c446ac37b7e79d971e55b3423981ada0c3db6459.tar.gz
qemu-c446ac37b7e79d971e55b3423981ada0c3db6459.tar.bz2
Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20201117' into staging
target-arm queue: * hw/arm/virt: ARM_VIRT must select ARM_GIC * exynos: Fix bad printf format specifiers * hw/input/ps2.c: Remove remnants of printf debug * target/openrisc: Remove dead code attempting to check "is timer disabled" * register: Remove unnecessary NULL check * util/cutils: Fix Coverity array overrun in freq_to_str() * configure: Make "does libgio work" test pull in some actual functions * tmp105: reset the T_low and T_High registers * tmp105: Correct handling of temperature limit checks # gpg: Signature made Tue 17 Nov 2020 13:47:48 GMT # gpg: using RSA key E1A5C593CD419DE28E8315CF3C2525ED14360CDE # gpg: issuer "peter.maydell@linaro.org" # gpg: Good signature from "Peter Maydell <peter.maydell@linaro.org>" [ultimate] # gpg: aka "Peter Maydell <pmaydell@gmail.com>" [ultimate] # gpg: aka "Peter Maydell <pmaydell@chiark.greenend.org.uk>" [ultimate] # Primary key fingerprint: E1A5 C593 CD41 9DE2 8E83 15CF 3C25 25ED 1436 0CDE * remotes/pmaydell/tags/pull-target-arm-20201117: tmp105: Correct handling of temperature limit checks hw/misc/tmp105: reset the T_low and T_High registers configure: Make "does libgio work" test pull in some actual functions util/cutils: Fix Coverity array overrun in freq_to_str() register: Remove unnecessary NULL check target/openrisc: Remove dead code attempting to check "is timer disabled" hw/input/ps2.c: Remove remnants of printf debug exynos: Fix bad printf format specifiers hw/arm/virt: ARM_VIRT must select ARM_GIC Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'util')
-rw-r--r--util/cutils.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/util/cutils.c b/util/cutils.c
index 9498e28..0b5073b 100644
--- a/util/cutils.c
+++ b/util/cutils.c
@@ -891,10 +891,11 @@ char *freq_to_str(uint64_t freq_hz)
double freq = freq_hz;
size_t idx = 0;
- while (freq >= 1000.0 && idx < ARRAY_SIZE(suffixes)) {
+ while (freq >= 1000.0) {
freq /= 1000.0;
idx++;
}
+ assert(idx < ARRAY_SIZE(suffixes));
return g_strdup_printf("%0.3g %sHz", freq, suffixes[idx]);
}