[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 20/25] cpu/x86: correctly set errors in x86_cpu_parse
From: |
Michael Tokarev |
Subject: |
[Qemu-devel] [PULL 20/25] cpu/x86: correctly set errors in x86_cpu_parse_featurestr |
Date: |
Tue, 10 Jun 2014 20:08:38 +0400 |
From: Paolo Bonzini <address@hidden>
Because of the "goto out", the contents of local_err are leaked
and lost.
Signed-off-by: Paolo Bonzini <address@hidden>
Signed-off-by: Michael Tokarev <address@hidden>
---
target-i386/cpu.c | 17 +++++++----------
1 file changed, 7 insertions(+), 10 deletions(-)
diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index dde052c..8983457 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -1688,8 +1688,8 @@ static void x86_cpu_parse_featurestr(CPUState *cs, char
*features,
numvalue = strtoul(val, &err, 0);
if (!*val || *err) {
- error_setg(&local_err, "bad numerical value %s", val);
- goto out;
+ error_setg(errp, "bad numerical value %s", val);
+ return;
}
if (numvalue < 0x80000000) {
error_report("xlevel value shall always be >= 0x80000000"
@@ -1706,8 +1706,8 @@ static void x86_cpu_parse_featurestr(CPUState *cs, char
*features,
tsc_freq = strtosz_suffix_unit(val, &err,
STRTOSZ_DEFSUFFIX_B, 1000);
if (tsc_freq < 0 || *err) {
- error_setg(&local_err, "bad numerical value %s", val);
- goto out;
+ error_setg(errp, "bad numerical value %s", val);
+ return;
}
snprintf(num, sizeof(num), "%" PRId64, tsc_freq);
object_property_parse(OBJECT(cpu), num, "tsc-frequency",
@@ -1718,8 +1718,8 @@ static void x86_cpu_parse_featurestr(CPUState *cs, char
*features,
char num[32];
numvalue = strtoul(val, &err, 0);
if (!*val || *err) {
- error_setg(&local_err, "bad numerical value %s", val);
- goto out;
+ error_setg(errp, "bad numerical value %s", val);
+ return;
}
if (numvalue < min) {
error_report("hv-spinlocks value shall always be >= 0x%x"
@@ -1738,7 +1738,7 @@ static void x86_cpu_parse_featurestr(CPUState *cs, char
*features,
}
if (local_err) {
error_propagate(errp, local_err);
- goto out;
+ return;
}
featurestr = strtok(NULL, ",");
}
@@ -1758,9 +1758,6 @@ static void x86_cpu_parse_featurestr(CPUState *cs, char
*features,
env->features[FEAT_KVM] &= ~minus_features[FEAT_KVM];
env->features[FEAT_SVM] &= ~minus_features[FEAT_SVM];
env->features[FEAT_7_0_EBX] &= ~minus_features[FEAT_7_0_EBX];
-
-out:
- return;
}
/* generate a composite string into buf of all cpuid names in featureset
--
1.7.10.4
- [Qemu-devel] [PULL 03/25] net: cadence_gem: Comment spelling sweep, (continued)
- [Qemu-devel] [PULL 03/25] net: cadence_gem: Comment spelling sweep, Michael Tokarev, 2014/06/10
- [Qemu-devel] [PULL 18/25] vdi: remove double conversion, Michael Tokarev, 2014/06/10
- [Qemu-devel] [PULL 11/25] hw/intc/openpic: Remove unused function IRQ_testbit(), Michael Tokarev, 2014/06/10
- [Qemu-devel] [PULL 13/25] target-i386/translate.c: Remove unused tcg_gen_lshift(), Michael Tokarev, 2014/06/10
- [Qemu-devel] [PULL 16/25] hw/net/ne2000-isa: Register vmstate struct, Michael Tokarev, 2014/06/10
- [Qemu-devel] [PULL 07/25] hw/i386/pc.c: Remove unused parallel_io and parallel_irq variables, Michael Tokarev, 2014/06/10
- [Qemu-devel] [PULL 25/25] virtio.c: fix error message, Michael Tokarev, 2014/06/10
- Re: [Qemu-devel] [PULL 00/25] Trivial patches for 2014-06-10, Peter Maydell, 2014/06/10
- [Qemu-devel] [PULL 09/25] util/qemu-sockets.c: Avoid unused variable warnings, Michael Tokarev, 2014/06/10
- [Qemu-devel] [PULL 08/25] hw/sd/sd.c: Drop unused sd_acmd_type[] array, Michael Tokarev, 2014/06/10
- [Qemu-devel] [PULL 20/25] cpu/x86: correctly set errors in x86_cpu_parse_featurestr,
Michael Tokarev <=
- [Qemu-devel] [PULL 15/25] target-microblaze: Delete unused sign_extend() function, Michael Tokarev, 2014/06/10