memory allocation for AMDVIIOTLBEntry in amdvi_update_iotlb()
In amdvi_update_iotlb() function there is memory allocation for the AMDVIIOTLBEntry object:
https://gitlab.com/qemu-project/qemu/-/blob/stable-7.2/hw/i386/amd_iommu.c?ref_type=heads#L349
However, all actions with allocated memory are performed only if the condition in line 354 is satisfied:
https://gitlab.com/qemu-project/qemu/-/blob/stable-7.2/hw/i386/amd_iommu.c?ref_type=heads#L354
By default (when created), value in this field is set to IOMMU_NONE, which does not satisfy this condition:
https://gitlab.com/qemu-project/qemu/-/blob/stable-7.2/hw/i386/amd_iommu.c?ref_type=heads#L1017
Of course, the value of this variable on the way to the instruction in line 354 can be changed, but it seems to me that it is worth reviewing the order of memory allocation for the AMDVIIOTLBEntry variable in the amdvi_update_iotlb() function, since at first glance, memory irrationally allocated here.
Found by Linux Verification Center (portal.linuxtesting.ru) with SVACE.
Author Ekaterina Zilotina.