]> xenbits.xensource.com Git - qemu-xen.git/commitdiff
qga: fix an off-by-one issue
authorLi Qiang <liq3ea@gmail.com>
Thu, 18 Oct 2018 02:10:37 +0000 (19:10 -0700)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Wed, 31 Oct 2018 14:04:20 +0000 (09:04 -0500)
Signed-off-by: Li Qiang <liq3ea@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
qga/commands-win32.c

index a1b7512d462c26be5b3ecee728f16676332fa309..ef1d7d48d2df7224cc87c4c995d84e381e63b73b 100644 (file)
@@ -485,7 +485,7 @@ static STORAGE_BUS_TYPE win2qemu[] = {
 
 static GuestDiskBusType find_bus_type(STORAGE_BUS_TYPE bus)
 {
-    if (bus > ARRAY_SIZE(win2qemu) || (int)bus < 0) {
+    if (bus >= ARRAY_SIZE(win2qemu) || (int)bus < 0) {
         return GUEST_DISK_BUS_TYPE_UNKNOWN;
     }
     return win2qemu[(int)bus];