[PATCH 7/7] qemu: Fix some issues in virQEMUDriverConfigLoadNVRAMEntry

Ján Tomko jtomko at redhat.com
Wed Dec 2 15:08:51 UTC 2020


On a Wednesday in 2020, John Ferlan wrote:
>Commit c4f4e195 fixed a double free, but if the code returns before
>we realloc the list and virFirmwareFreeList was called with cfg->nfirmwares
>> 0 (e.g. during virQEMUDriverConfigDispose), then it would be rather
>disasterous. So let's reinitialze that too to indicate the list is empty.

*disastrous
*reinitialize

>
>Coverity pointed out that using nvram[0] as a guard to reallocating the
>list could lead to a possible NULL deref. While nvram[0] may always be
>true in this case, if it wasn't then the subsequent for loop would fail.
>Just reallocate always regardless - even if nfirmwares == 0 as
>virFirmwareFreeList will free it for us anyway.
>
>Signed-off-by: John Ferlan <jferlan at redhat.com>
>---
> src/qemu/qemu_conf.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>

Reviewed-by: Ján Tomko <jtomko at redhat.com>

Jano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20201202/7eb553ee/attachment-0001.sig>


More information about the libvir-list mailing list