diff options
| author | Zixun LI <[email protected]> | 2026-06-06 10:27:09 +0200 |
|---|---|---|
| committer | Mattijs Korpershoek <[email protected]> | 2026-06-15 09:15:25 +0200 |
| commit | 033eb908d0a8ed938bc652f34a2d702a29a8726f (patch) | |
| tree | 8b98c308dc9cc90689234c1ae788e3608a904591 | |
| parent | e41e97e6e6061fec5a2fb069eaad662cf6359a93 (diff) | |
usb: gadget: atmel: use calloc() to allocate endpoint list
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 <[email protected]>
Reviewed-by: Marek Vasut <[email protected]>
Reviewed-by: Mattijs Korpershoek <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Mattijs Korpershoek <[email protected]>
| -rw-r--r-- | drivers/usb/gadget/atmel_usba_udc.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/usb/gadget/atmel_usba_udc.c b/drivers/usb/gadget/atmel_usba_udc.c index a2eee2bca2c..0caf8b8b7b4 100644 --- a/drivers/usb/gadget/atmel_usba_udc.c +++ b/drivers/usb/gadget/atmel_usba_udc.c @@ -1201,7 +1201,7 @@ static struct usba_ep *usba_udc_pdata(struct usba_platform_data *pdata, 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; |
