summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2017-08-04 13:46:22 +0100
committerPeter Maydell <peter.maydell@linaro.org>2017-08-04 13:46:22 +0100
commitac44ed2afb7c60255e989b163301479f5b4ecd04 (patch)
treed68780f5b0656175368f4fe76be70fbb5687183b
parentc233a35d3d91af666aa95a6a3ba8244d4ce728c6 (diff)
parentbe2960baae07e5257cde8c814cbd91647e235147 (diff)
downloadqemu-ac44ed2afb7c60255e989b163301479f5b4ecd04.tar.gz
Merge remote-tracking branch 'remotes/ehabkost/tags/machine-pull-request' into staging
cpu: crash fix (don't allow negative core id) # gpg: Signature made Thu 03 Aug 2017 18:57:41 BST # gpg: using RSA key 0x2807936F984DC5A6 # gpg: Good signature from "Eduardo Habkost <ehabkost@redhat.com>" # Primary key fingerprint: 5A32 2FD5 ABC4 D3DB ACCF D1AA 2807 936F 984D C5A6 * remotes/ehabkost/tags/machine-pull-request: cpu: don't allow negative core id Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-rw-r--r--hw/cpu/core.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/hw/cpu/core.c b/hw/cpu/core.c
index 2bf960d6a8..bd578ab80c 100644
--- a/hw/cpu/core.c
+++ b/hw/cpu/core.c
@@ -33,6 +33,11 @@ static void core_prop_set_core_id(Object *obj, Visitor *v, const char *name,
return;
}
+ if (value < 0) {
+ error_setg(errp, "Invalid core id %"PRId64, value);
+ return;
+ }
+
core->core_id = value;
}