From: Xiao Guangrong <guangrong.xiao@linux.intel.com>
To: Stefan Hajnoczi <stefanha@redhat.com>
Cc: qemu-devel@nongnu.org, imammedo@redhat.com,
"Michael S. Tsirkin" <mst@redhat.com>,
"Zhang, Haozhong" <haozhong.zhang@intel.com>
Subject: Re: [Qemu-devel] [PATCH] nvdimm acpi: fix g_array_free() with NULL pointer
Date: Fri, 13 Jan 2017 08:50:11 +0800 [thread overview]
Message-ID: <1df82bd1-1b5d-3d68-b555-f405b43fccb0@linux.intel.com> (raw)
In-Reply-To: <20170112110928.GF4621@stefanha-x1.localdomain>
CCed Haozhong
On 01/12/2017 07:09 PM, Stefan Hajnoczi wrote:
> On Thu, Jan 12, 2017 at 11:18:25AM +0800, Xiao Guangrong wrote:
>>
>>
>> On 01/11/2017 05:36 PM, Stefan Hajnoczi wrote:
>>> Unlike g_free(), g_array_free() does not accept a NULL pointer argument.
>>> The following error is logged when an nvdimm device is realized:
>>>
>>> GLib-CRITICAL **: g_array_free: assertion 'array' failed
>>>
>>> Cc: Xiao Guangrong <guangrong.xiao@linux.intel.com>
>>> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
>>> ---
>>> hw/acpi/nvdimm.c | 4 +++-
>>> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> NACK
>
>>>
>>> diff --git a/hw/acpi/nvdimm.c b/hw/acpi/nvdimm.c
>>> index 8e7d6ec..8f0a484 100644
>>> --- a/hw/acpi/nvdimm.c
>>> +++ b/hw/acpi/nvdimm.c
>>> @@ -375,7 +375,9 @@ static void nvdimm_init_fit_buffer(NvdimmFitBuffer *fit_buf)
>>>
>>> static void nvdimm_build_fit_buffer(NvdimmFitBuffer *fit_buf)
>>> {
>>> - g_array_free(fit_buf->fit, true);
>>> + if (fit_buf->fit) {
>>> + g_array_free(fit_buf->fit, true);
>>> + }
>>
>> Er, i do not know why it is NULL as we have init-ed it in nvdimm_init_fit_buffer:
>>
>> static void nvdimm_init_fit_buffer(NvdimmFitBuffer *fit_buf)
>> {
>> fit_buf->fit = g_array_new(false, true /* clear */, 1);
>> }
>>
>> And i can not reproduce it on my box, could you share your command line and the
>> based commit id?
>
> Good point, it happens when nvdimm_plug() is called but -M pc,nvdimm is
> missing from the command-line. This means nvdimm_init_acpi_state() was
> not called by pc_init1():
>
> $ x86_64-softmmu/qemu-system-x86_64 \
> -enable-kvm \
> -m 1G,slots=2,maxmem=16G \
> -drive if=virtio,file=test.img,format=raw \
> -object memory-backend-file,id=hostmem0,mem-path=mydimm,share=on,size=8G \
> -device nvdimm,id=nvdimm0,memdev=hostmem0
>
> Do you want to audit the code to check if anything else misbehaves when
> -device nvdimm is used without -M pc,nvdimm?
Yes. Haozhong will help me to audit the code and fix this crash.
Thanks for your report, Stefan!
next prev parent reply other threads:[~2017-01-13 0:59 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-11 9:36 [Qemu-devel] [PATCH] nvdimm acpi: fix g_array_free() with NULL pointer Stefan Hajnoczi
2017-01-12 3:18 ` Xiao Guangrong
2017-01-12 11:09 ` Stefan Hajnoczi
2017-01-13 0:50 ` Xiao Guangrong [this message]
-- strict thread matches above, loose matches on Subject: below --
2017-01-11 9:44 Stefan Hajnoczi
2017-01-11 16:08 ` Igor Mammedov
2017-01-12 10:58 ` Stefan Hajnoczi
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=1df82bd1-1b5d-3d68-b555-f405b43fccb0@linux.intel.com \
--to=guangrong.xiao@linux.intel.com \
--cc=haozhong.zhang@intel.com \
--cc=imammedo@redhat.com \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/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).