qga: fix an off-by-one issue
PATCH 1/1 qga: fix an off-by-one issue
Signed-off-by Li Qiang <[email protected]>
--- qga/commands-win32.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
qga/commands-win32.c +1 -1
@@ -465,7 +465,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];
Signature · 1 line
1.8.3.1
Missed in a3ef3b2272d.
Quoted 1 line · Li Qiang
Signed-off-by Li Qiang <[email protected]>
Nice catch btw.
Reviewed-by Philippe Mathieu-Daudé <[email protected]>
Quoted 18 lines
--- qga/commands-win32.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)qga/commands-win32.c +1
-1@@ -465,7 +465,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];
Michael Roth
AppliedQuoting Li Qiang (2018-10-17 21:10:37)
Quoted 1 line
Signed-off-by Li Qiang <[email protected]>
Thanks, applied to qga tree:
https://github.com/mdroth/qemu/commits/qga
Quoted 20 lines
--- qga/commands-win32.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)qga/commands-win32.c +1
-1@@ -465,7 +465,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];Signature · 1 line
1.8.3.1