summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tools/usb/usbip/libsrc/vhci_driver.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/tools/usb/usbip/libsrc/vhci_driver.c b/tools/usb/usbip/libsrc/vhci_driver.c
index f659c146cdc8..036b62be0fc7 100644
--- a/tools/usb/usbip/libsrc/vhci_driver.c
+++ b/tools/usb/usbip/libsrc/vhci_driver.c
@@ -220,9 +220,16 @@ int usbip_vhci_driver_open(void)
}
vhci_driver->nports = get_nports();
-
dbg("available ports: %d", vhci_driver->nports);
+ if (vhci_driver->nports <= 0) {
+ err("no available ports");
+ goto err;
+ } else if (vhci_driver->nports > MAXNPORT) {
+ err("port number exceeds %d", MAXNPORT);
+ goto err;
+ }
+
if (refresh_imported_device_list())
goto err;