qga: fix an off-by-one issue
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>
diff --git a/qga/commands-win32.c b/qga/commands-win32.c
index a1b7512..ef1d7d4 100644
--- a/qga/commands-win32.c
+++ b/qga/commands-win32.c
@@ -485,7 +485,7 @@
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];