Re: [PATCH kvm-unit-tests v5 13/14] pci: add msi support for 32/64bit address

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

 



On Mon, Nov 21, 2016 at 08:27:52PM +0100, Alexander Gordeev wrote:

[...]

> > +void pci_cap_walk(struct pci_dev *dev)
> > +{
> > +	uint8_t cap_offset;
> > +	uint8_t cap_id;
> > +
> > +	cap_offset = pci_config_readb(dev->bdf, PCI_CAPABILITY_LIST);
> > +	while (cap_offset) {
> > +		cap_id = pci_config_readb(dev->bdf, cap_offset);
> > +		printf("PCI detected cap 0x%x\n", cap_id);
> > +		if (cap_handlers[cap_id])
> > +			cap_handlers[cap_id](dev, cap_offset);
> > +		cap_offset = pci_config_readb(dev->bdf, cap_offset + 1);
> > +	}
> > +}
> 
> Are you sure the function above is safe without range (sanity) checks?

No. :) But if something goes wrong, I guess that's possibly a QEMU PCI
bug. I can add some check if you think is necessary, like, make sure
the loop goes no more than a specific value?

Thanks,

-- peterx
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux