qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] ui/gtk: fix NULL pointer dereference


From: Philippe Mathieu-Daudé
Subject: Re: [PATCH] ui/gtk: fix NULL pointer dereference
Date: Mon, 8 Mar 2021 15:30:23 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.0

On 3/8/21 3:17 PM, Akihiko Odaki wrote:
> 2021年3月8日(月) 23:03 Christian Schoenebeck <qemu_oss@crudebyte.com>:
>>
>> BTW, there is __nonnull supported by clang, e.g.:
>>
>> static void foo(void *__nonnull p) {
>>         ...
>> }
>>
>> Maybe as an optionally defined macro (if supported by compiler) this could be
>> a useful tool for such intended nonnull designs, as it immediately emits
>> compiler errors.
>>
>> Best regards,
>> Christian Schoenebeck
>>
>>
> 
> GCC has nonnull attribute and clang accepts it too. However, it
> specifies argument indices, which is harder to understand and to
> maintain.
> __attribute__((nonnull(2)))
> void f(void *k, void *l);

Richard once suggested to add QEMU_NONNULL(), I have been using
it on a series trying to enforce non-null uses of QOM
'struct Object *owner' but it didn't work out because migrations
of MemoryRegion, some have NULL owner in MachineState.

I also discarded it because Daniel said it could have side-effects
https://www.mail-archive.com/qemu-devel@nongnu.org/msg720739.html




reply via email to

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