summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortaeyoung <ty317.kim@samsung.com>2016-10-10 15:34:28 +0900
committerKunhoon Baik <knhoon.baik@samsung.com>2016-10-11 13:32:50 +0900
commit925ddab7ce6b19d6fdadf19e6e358cad09403e88 (patch)
tree114130096fea9c54fe86e65affdaf30507f04e48
parentdb3e02344988a077005923b26baceb0728656525 (diff)
downloaddevice-manager-plugin-odroid-925ddab7ce6b19d6fdadf19e6e358cad09403e88.tar.gz
device-manager-plugin-odroid-925ddab7ce6b19d6fdadf19e6e358cad09403e88.tar.bz2
device-manager-plugin-odroid-925ddab7ce6b19d6fdadf19e6e358cad09403e88.zip
refer to : https://review.tizen.org/gerrit/#/c/91714/ Change-Id: Ie8e9a4cbf8e3e4c0d625f8b24df3d16aa7074682 Signed-off-by: taeyoung <ty317.kim@samsung.com>
-rw-r--r--hw/usb_gadget/usb_gadget.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/hw/usb_gadget/usb_gadget.c b/hw/usb_gadget/usb_gadget.c
index 0bcb10b..fcf144c 100644
--- a/hw/usb_gadget/usb_gadget.c
+++ b/hw/usb_gadget/usb_gadget.c
@@ -185,7 +185,7 @@ static int simple_id_to_gadget(struct usb_gadget_id *gadget_id,
struct usb_gadget **_gadget)
{
struct usb_gadget *gadget;
- int n_configs;
+ int n_configs = 0;
/* zero terminates */
int functions[2][sizeof(gadget_id->function_mask)*8];
int n_functions;
@@ -285,7 +285,7 @@ static int simple_id_to_gadget(struct usb_gadget_id *gadget_id,
break;
};
- if (n_configs > 2) {
+ if (n_configs > 2 || n_configs <= 0) {
ret = -EINVAL;
goto free_gadget;
}