[libvirt] [PATCH 12/12] Fix off-by-1 in SCSI drive hotplug

Daniel Veillard veillard at redhat.com
Wed Jan 20 17:55:11 UTC 2010


On Wed, Jan 20, 2010 at 03:15:09PM +0000, Daniel P. Berrange wrote:
> The loop looking for the controller associated with a SCI drive had
> an off by one, causing it to miss the last controller.
> 
> * src/qemu/qemu_driver.c: Fix off-by-1 in searching for SCSI
>   drive hotplug
> ---
>  src/qemu/qemu_driver.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index cb6fe86..d546975 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
> @@ -5346,7 +5346,7 @@ static int qemudDomainAttachSCSIDisk(virConnectPtr conn,
>          goto error;
>      }
>  
> -    for (i = 0 ; i < disk->info.addr.drive.controller ; i++) {
> +    for (i = 0 ; i <= disk->info.addr.drive.controller ; i++) {
>          cont = qemuDomainFindOrCreateSCSIDiskController(conn, driver, vm, i);
>          if (!cont)
>              goto error;

  Ah, yes, it's initialized by
    def->info.addr.drive.controller = idx / 7;
so 0 need to be checked,

  ACK,

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel at veillard.com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/




More information about the libvir-list mailing list