summaryrefslogtreecommitdiff
path: root/drivers/usb/gadget
diff options
context:
space:
mode:
authorBui Quang Minh <minhquangbui99@gmail.com>2020-12-04 09:24:49 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-12-07 17:25:23 +0300
commite90cfa813da7a527785033a0b247594c2de93dd8 (patch)
tree03b8b6375ea204a1ca1e3e2ed5d8ff521facd60e /drivers/usb/gadget
parentc7721e15f434920145c376e8fe77e1c079fc3726 (diff)
downloadlinux-e90cfa813da7a527785033a0b247594c2de93dd8.tar.xz
USB: dummy-hcd: Fix uninitialized array use in init()
This error path err_add_pdata: for (i = 0; i < mod_data.num; i++) kfree(dum[i]); can be triggered when not all dum's elements are initialized. Fix this by initializing all dum's elements to NULL. Acked-by: Alan Stern <stern@rowland.harvard.edu> Cc: stable <stable@vger.kernel.org> Signed-off-by: Bui Quang Minh <minhquangbui99@gmail.com> Link: https://lore.kernel.org/r/1607063090-3426-1-git-send-email-minhquangbui99@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/gadget')
-rw-r--r--drivers/usb/gadget/udc/dummy_hcd.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/usb/gadget/udc/dummy_hcd.c b/drivers/usb/gadget/udc/dummy_hcd.c
index f6b407778179..ab5e978b5052 100644
--- a/drivers/usb/gadget/udc/dummy_hcd.c
+++ b/drivers/usb/gadget/udc/dummy_hcd.c
@@ -2738,7 +2738,7 @@ static int __init init(void)
{
int retval = -ENOMEM;
int i;
- struct dummy *dum[MAX_NUM_UDC];
+ struct dummy *dum[MAX_NUM_UDC] = {};
if (usb_disabled())
return -ENODEV;