qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v2 14/20] memory-device: ids of virtio based dev


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH v2 14/20] memory-device: ids of virtio based devices are special
Date: Fri, 31 Aug 2018 10:01:15 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1

On 08/31/2018 06:18 AM, David Hildenbrand wrote:

-                error_setg(errp, "address range conflicts with '%s'", d->id);
+                error_setg(errp, "address range conflicts with '%s'",
+                           id ? id : 0);

What's that 'id ? id : 0' trick for?

0 -> "", then it actually makes sense :)



qemu-system-x86_64: -device pc-dimm,memdev=mem1,addr=0x140000000:
address range conflicts with '(null)'

(I thought providing NULL would lead to a crash, but it is actually
handled properly)

Well, glibc handles it. But POSIX says it is undefined, and there are other libc where it indeed crashes. It's better to pass an explicit non-null placeholder than to rely on glibc turning NULL into "(null)".

--
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org



reply via email to

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