From: Zesen Liu <[email protected]> When specifying lbr_fmt=VALUE in cpu options with an invalid VALUE, error_setg() gets triggered twice, causing an assertion failure in error_setv() which requires *errp to be NULL, preventing meaningful error messages from being displayed.
Fix this by checking visit_type_uint64()'s return value and returning early on failure, consistent with other property setters like set_string(). Fixes: 18c22d7112a7 (qdev-properties: Add a new macro with bitmask check for uint64_t property) Cc: [email protected] Signed-off-by: Zesen Liu <[email protected]> Message-ID: <[email protected]> Reviewed-by: Markus Armbruster <[email protected]> [Add Fixes: and Cc:] Signed-off-by: Markus Armbruster <[email protected]> (cherry picked from commit 00829ae3845fd11e56239390924e3e74c3a4c144) Signed-off-by: Michael Tokarev <[email protected]> diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index 147b3ffd16..05e1fae183 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -429,7 +429,9 @@ static void set_uint64_checkmask(Object *obj, Visitor *v, const char *name, const Property *prop = opaque; uint64_t *ptr = object_field_prop_ptr(obj, prop); - visit_type_uint64(v, name, ptr, errp); + if (!visit_type_uint64(v, name, ptr, errp)) { + return; + } if (*ptr & ~prop->bitmask) { error_setg(errp, "Property value for '%s' has bits outside mask '0x%" PRIx64 "'", name, prop->bitmask); -- 2.47.3
