Patchwork qom: Fix object_initialize_with_type() assertion

login
register
mail settings
Submitter Andreas Färber
Date Feb. 19, 2012, 11:49 p.m.
Message ID <1329695347-9289-1-git-send-email-afaerber@suse.de>
Download mbox | patch
Permalink /patch/142088/
State New
Headers show

Comments

Andreas Färber - Feb. 19, 2012, 11:49 p.m.
Assert the object is at least sizeof(Object), not sizeof(ObjectClass).

Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 qom/object.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Paolo Bonzini - Feb. 20, 2012, 9:11 a.m.
On 02/20/2012 12:49 AM, Andreas Färber wrote:
> Assert the object is at least sizeof(Object), not sizeof(ObjectClass).
> 
> Signed-off-by: Andreas Färber <afaerber@suse.de>
> ---
>  qom/object.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/qom/object.c b/qom/object.c
> index b1ead15..dbfd6a4 100644
> --- a/qom/object.c
> +++ b/qom/object.c
> @@ -262,7 +262,7 @@ void object_initialize_with_type(void *data, TypeImpl *type)
>      Object *obj = data;
>  
>      g_assert(type != NULL);
> -    g_assert(type->instance_size >= sizeof(ObjectClass));
> +    g_assert(type->instance_size >= sizeof(Object));
>  
>      type_class_init(type);
>      g_assert(type->abstract == false);

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>

Paolo
Anthony Liguori - Feb. 22, 2012, 6:53 p.m.
On 02/19/2012 05:49 PM, Andreas Färber wrote:
> Assert the object is at least sizeof(Object), not sizeof(ObjectClass).
>
> Signed-off-by: Andreas Färber<afaerber@suse.de>

Applied.  Thanks.

Regards,

Anthony Liguori

> ---
>   qom/object.c |    2 +-
>   1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/qom/object.c b/qom/object.c
> index b1ead15..dbfd6a4 100644
> --- a/qom/object.c
> +++ b/qom/object.c
> @@ -262,7 +262,7 @@ void object_initialize_with_type(void *data, TypeImpl *type)
>       Object *obj = data;
>
>       g_assert(type != NULL);
> -    g_assert(type->instance_size>= sizeof(ObjectClass));
> +    g_assert(type->instance_size>= sizeof(Object));
>
>       type_class_init(type);
>       g_assert(type->abstract == false);

Patch

diff --git a/qom/object.c b/qom/object.c
index b1ead15..dbfd6a4 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -262,7 +262,7 @@  void object_initialize_with_type(void *data, TypeImpl *type)
     Object *obj = data;
 
     g_assert(type != NULL);
-    g_assert(type->instance_size >= sizeof(ObjectClass));
+    g_assert(type->instance_size >= sizeof(Object));
 
     type_class_init(type);
     g_assert(type->abstract == false);