From: Juan Quintela <quintela@redhat.com>
To: "Cédric Le Goater" <clg@kaod.org>
Cc: "Dr. David Alan Gilbert" <dgilbert@redhat.com>,
lvivier@redhat.com, pbonzini@redhat.com, qemu-devel@nongnu.org,
peterx@redhat.com
Subject: Re: [Qemu-devel] [PATCH 2/2] tests: Make acpid test compile
Date: Wed, 30 Aug 2017 12:51:23 +0200 [thread overview]
Message-ID: <874lsp72hg.fsf@secure.mitica> (raw)
In-Reply-To: <bbe64c5c-8906-2bf9-92a8-8fda49100505@kaod.org> ("Cédric Le Goater"'s message of "Mon, 28 Aug 2017 16:41:16 +0200")
Cedric Le Goater <clg@kaod.org> wrote:
> On 08/23/2017 01:53 PM, Dr. David Alan Gilbert wrote:
>> * Juan Quintela (quintela@redhat.com) wrote:
>>> Compiler gets confused with the size of the struct, so move form
>>> g_new0() to g_malloc0().
>>>
>>> I *think* that the problem is in gcc (or glib for that matter), but
>>> the documentation of the g_new0 states that 1sts first argument is an
>>> struct type, and uint32_t is not an struct type.
>>>
>>> Signed-off-by: Juan Quintela <quintela@redhat.com>
>>> ---
>>> tests/vmgenid-test.c | 2 +-
>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/tests/vmgenid-test.c b/tests/vmgenid-test.c
>>> index 3d5c1c3615..032e1d465a 100644
>>> --- a/tests/vmgenid-test.c
>>> +++ b/tests/vmgenid-test.c
>>> @@ -67,7 +67,7 @@ static uint32_t acpi_find_vgia(void)
>>> g_assert_cmpint(tables_nr, >, 0);
>>>
>>> /* get the addresses of the tables pointed by rsdt */
>>> - tables = g_new0(uint32_t, tables_nr);
>>> + tables = g_malloc0(sizeof(uint32_t) * tables_nr);
>>
>> I think there's an easier fix for this I think;
>> try:
>>
>> - g_assert_cmpint(tables_nr, >, 0);
>> + g_assert(tables_nr > 0);
I liked more the following one.
>
> I fixed that one with :
>
> @@ -40,7 +40,7 @@ static uint32_t acpi_find_vgia(void)
> AcpiRsdpDescriptor rsdp_table;
> uint32_t rsdt;
> AcpiRsdtDescriptorRev1 rsdt_table;
> - int tables_nr;
> + uint32_t tables_nr;
> uint32_t *tables;
> AcpiTableHeader ssdt_table;
> VgidTable vgid_table;
This make things work for me, so moving to this one.
Thanks, Juan.
next prev parent reply other threads:[~2017-08-30 10:51 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-23 8:38 [Qemu-devel] [PATCH 0/2] Fix tests on recent gcc Juan Quintela
2017-08-23 8:39 ` [Qemu-devel] [PATCH 1/2] tests: Use real size for iov tests Juan Quintela
2017-08-23 11:18 ` Peter Xu
2017-08-23 11:35 ` Juan Quintela
2017-08-28 16:10 ` Thomas Huth
2017-08-30 9:45 ` Juan Quintela
2017-08-30 11:34 ` Juan Quintela
2017-08-23 8:39 ` [Qemu-devel] [PATCH 2/2] tests: Make acpid test compile Juan Quintela
2017-08-23 11:53 ` Dr. David Alan Gilbert
2017-08-28 14:41 ` Cédric Le Goater
2017-08-29 20:17 ` Eric Blake
2017-08-30 10:45 ` Daniel P. Berrange
2017-08-30 11:37 ` Juan Quintela
2017-08-30 10:51 ` Juan Quintela [this message]
2017-08-30 11:07 ` Daniel P. Berrange
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=874lsp72hg.fsf@secure.mitica \
--to=quintela@redhat.com \
--cc=clg@kaod.org \
--cc=dgilbert@redhat.com \
--cc=lvivier@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peterx@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).