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().

Signed-off-by: Zesen Liu <[email protected]>
---
 hw/core/qdev-properties.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c
index 422a486969..0930d64252 100644
--- a/hw/core/qdev-properties.c
+++ b/hw/core/qdev-properties.c
@@ -494,7 +494,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);

---
base-commit: 7154e4df40468012fccb6687ecd2b288c56a4a2d
change-id: 20251217-qdev-fix-207bea2b8a14

Best regards,
-- 
Zesen Liu <[email protected]>


Reply via email to