[libvirt] [PATCH 2/3] qemu: When reserving all functions on a slot don't reserve function 0 on the next slot.

Eric Blake eblake at redhat.com
Wed Aug 24 16:49:56 UTC 2011


On 08/24/2011 09:31 AM, Shradha Shah wrote:

Again a long subject; I changed to:

qemu: fix off-by-one in pci slot reservation

> Signed-off-by: Steve Hodgson<shodgson at solarflare.com>
> ---
>   src/qemu/qemu_command.c |    4 ++--
>   1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
> index dbfc7d9..12adcc0 100644
> --- a/src/qemu/qemu_command.c
> +++ b/src/qemu/qemu_command.c
> @@ -878,7 +878,7 @@ int qemuDomainPCIAddressReserveSlot(qemuDomainPCIAddressSetPtr addrs,
>   {
>       int function;
>
> -    for (function = 0; function<= QEMU_PCI_ADDRESS_LAST_FUNCTION; function++) {
> +    for (function = 0; function<  QEMU_PCI_ADDRESS_LAST_FUNCTION; function++) {

Ouch.  A nasty off-by-one, given that qemuDomainPCIAddressCheckSlot 
already used < instead of <=.

ACK and pushed.

-- 
Eric Blake   eblake at redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org




More information about the libvir-list mailing list