qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 1/8] qapi: fix NULL pointer dereference


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH 1/8] qapi: fix NULL pointer dereference
Date: Fri, 16 Dec 2011 16:13:14 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:7.0.1) Gecko/20110930 Thunderbird/7.0.1

On 12/16/2011 04:05 PM, Anthony Liguori wrote:


What are the uses of null in qdev string properties? I know you can't
set a string to null since parse() doesn't have a null syntax. So we're
really just talking about an uninitialized state, right?

Yes. No ROM BAR is an example of a NULL string property.

So it's really filenames and backend names, right?  Can we just treat
empty strings like NULL?  I think all of the various bits handles both
the same way.

The only case I can think of when it differs is serial numbers. An empty serial number is different from no serial number (which means do not expose one at all).

However, DEFINE_PROP_STRING does not allow setting a default, and some device models rely on a NULL value as a default. I see two ways out: 1) add nullable strings; 2) merge without this patch, knowing qom-get is kind-of broken, and proceed adding a default to all DEFINE_PROP_STRING; this would be a merge nightmare for you. 3) merge without this patch, knowing it's kind-of broken, and later decide what to do.

Let's do (3), and add nullable strings if the discussion stalls.

Paolo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]