[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1607063090-3426-1-git-send-email-minhquangbui99@gmail.com>
Date: Fri, 4 Dec 2020 06:24:49 +0000
From: Bui Quang Minh <minhquangbui99@...il.com>
To: unlisted-recipients:; (no To-header on input)
Cc: Bui Quang Minh <minhquangbui99@...il.com>,
Felipe Balbi <balbi@...nel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Corentin Labbe <clabbe@...libre.com>,
Alan Stern <stern@...land.harvard.edu>,
Jules Irenge <jbi.octave@...il.com>,
Andrey Konovalov <andreyknvl@...il.com>,
linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH] 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.
Signed-off-by: Bui Quang Minh <minhquangbui99@...il.com>
---
drivers/usb/gadget/udc/dummy_hcd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/usb/gadget/udc/dummy_hcd.c b/drivers/usb/gadget/udc/dummy_hcd.c
index 0eeaead..a2cf009 100644
--- a/drivers/usb/gadget/udc/dummy_hcd.c
+++ b/drivers/usb/gadget/udc/dummy_hcd.c
@@ -2734,7 +2734,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;
--
2.7.4
Powered by blists - more mailing lists