malloc() doesn't zero out memory, leaving ep->ep.enabled uninitiated,
which could make this flag falsely true.
In next usb_ep_enable() call since this flag is true, ep->ops->enable()
will be skipped. Then usb_ep_queue() will fail on uninitialized endpoint.
Fixes: 59310d1ecb9f ("usb: gadget: introduce 'enabled' flag in struct usb_ep")
Signed-off-by: Zixun LI <admin@hifiphile.com>
Reviewed-by: Marek Vasut <marek.vasut+usb@mailbox.org>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@kernel.org>
Link: https://patch.msgid.link/20260606-udc_malloc-v2-1-1155326b182b@hifiphile.com
Signed-off-by: Mattijs Korpershoek <mkorpershoek@kernel.org>
struct usba_ep *eps;
int i;
- eps = malloc(sizeof(struct usba_ep) * pdata->num_ep);
+ eps = calloc(pdata->num_ep, sizeof(struct usba_ep));
if (!eps) {
log_err("failed to alloc eps\n");
return NULL;