Skip to contentSkip to conversation

qom: Fix object_property_add_alias() with [*]

PATCH In review Andreas Färber 3 participants 3 messages Mar 29, 2015 – Mar 30, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 qom: Fix object_property_add_alias() with [*]

Commit 8074264 (qom: Add description field in ObjectProperty struct) introduced property descriptions and copied them for alias properties.

Instead of using the caller-supplied property name, use the returned property name for setting the description. This avoids an Error when setting a property description for a property with literal "[*]" that doesn't exist due to automatic property naming in object_property_add().

Cc Gonglei <[email protected]>
Cc Paolo Bonzini <[email protected]>
Cc Michael S. Tsirkin <[email protected]>
---
 qom/object.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
qom/object.c +1 -1
index d167038..b8dff43 100644
@@ -1761,7 +1761,7 @@ void object_property_add_alias(Object *obj, const char *name,
     }
     op->resolve = property_resolve_alias;
 
-    object_property_set_description(obj, name,
+    object_property_set_description(obj, op->name,
                                     target_prop->description,
                                     &error_abort);
 
Signature · 1 line
2.1.4
Reviewed-by on v1 1/1
#1 lore raw
Quoted 21 lines · Andreas Färber

Commit 8074264 (qom: Add description field in ObjectProperty struct) introduced property descriptions and copied them for alias properties.

Instead of using the caller-supplied property name, use the returned property name for setting the description. This avoids an Error when setting a property description for a property with literal "[*]" that doesn't exist due to automatic property naming in object_property_add().

Cc Gonglei <[email protected]>
Cc Paolo Bonzini <[email protected]>
Cc Michael S. Tsirkin <[email protected]>
---
 qom/object.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
qom/object.c +0 -0
index d167038..b8dff43 100644

qom/object.c void object_property_add_alias(Object *obj, const char *name, · line 1767

Quoted 8 lines
qom/object.c +1 -1
@@ -1761,7 +1761,7 @@ void object_property_add_alias(Object *obj, const char *name,
     }
     op->resolve = property_resolve_alias;
 
-    object_property_set_description(obj, name,
+    object_property_set_description(obj, op->name,
                                     target_prop->description,
                                     &error_abort);
 

Looks good to me. I think this is a candidate for 2.3 rc2.

Cc qemu-stable <[email protected]>

Regards,
-Gonglei

Acked-by on v1 1/1
#2 lore raw
In reply to Andreas Färber
Quoted 22 lines · Andreas Färber

Commit 8074264 (qom: Add description field in ObjectProperty struct) introduced property descriptions and copied them for alias properties.

Instead of using the caller-supplied property name, use the returned property name for setting the description. This avoids an Error when setting a property description for a property with literal "[*]" that doesn't exist due to automatic property naming in object_property_add().

Cc Gonglei <[email protected]>
Cc Paolo Bonzini <[email protected]>
Cc Michael S. Tsirkin <[email protected]>
---
 qom/object.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
qom/object.c +0 -0
index d167038..b8dff43 100644

qom/object.c void object_property_add_alias(Object *obj, const char *name, · line 1767

Quoted 8 lines
qom/object.c +1 -1
@@ -1761,7 +1761,7 @@ void object_property_add_alias(Object *obj, const char *name,
     }
     op->resolve = property_resolve_alias;
 
-    object_property_set_description(obj, name,
+    object_property_set_description(obj, op->name,
                                     target_prop->description,
                                     &error_abort);