[PATCH libvirt v1 4/6] qemu: move ZPCI uid validation into device validation
Shalini Chellathurai Saroja
shalini at linux.ibm.com
Mon Jun 8 08:17:26 UTC 2020
Hi Andrea,
Thank you for the review.
On 6/3/20 2:15 PM, Andrea Bolognani wrote:
> On Thu, 2020-04-09 at 12:31 +0200, Shalini Chellathurai Saroja wrote:
>> +static bool
>> +qemuDomainDeviceDefValidateZPCIUid(virZPCIDeviceAddressPtr zpci)
>> +{
>> + if (zpci->uid_set &&
>> + (zpci->uid > VIR_DOMAIN_DEVICE_ZPCI_MAX_UID ||
>> + zpci->uid == 0)) {
>> + virReportError(VIR_ERR_XML_ERROR,
>> + _("Invalid PCI address uid='0x%.4x', "
>> + "must be > 0x0000 and <= 0x%.4x"),
>> + zpci->uid,
>> + VIR_DOMAIN_DEVICE_ZPCI_MAX_UID);
>> + return false;
>> + }
>> +
>> + return true;
>> +}
>> +
>> +
>> static int
>> qemuValidateDomainDeviceDefZPCIAddress(virDomainDeviceInfoPtr info,
>> virQEMUCapsPtr qemuCaps)
>> @@ -960,6 +978,12 @@ qemuValidateDomainDeviceDefZPCIAddress(virDomainDeviceInfoPtr info,
>> return -1;
>> }
>>
>> + /* We don't need to check fid because fid covers
>> + * all range of uint32 type.
>> + */
>> + if (!qemuDomainDeviceDefValidateZPCIUid(&info->addr.pci.zpci))
>> + return -1;
> No need to create a separate function, just perform the check inline
> here.
ok, I will do it.
>
More information about the libvir-list
mailing list