usb: gadget: atmel: use calloc() to allocate endpoint list
Subsystems (2)
PATCH RESEND 1/1 usb: gadget: atmel: use calloc() to allocate endpoint list
malloc() doesn't zero out memory, leaving ep->ep.enabled uninitiated.
Fixes 59310d1ecb9f ("usb: gadget: introduce 'enabled' flag in struct usb_ep")
Signed-off-by Zixun LI <[email protected]>
--- drivers/usb/gadget/atmel_usba_udc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/gadget/atmel_usba_udc.c +1 -1
@@ -1219,7 +1219,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 ;
---
base-commit: 5732bd0f457b4c671e46574d64d4acb099c0f0a5
change-id: 20260521-udc_malloc-eb8355d08afe
Best regards,
--
Zixun LI <[email protected]>
Signature · 1 line
Zixun LI <[email protected]>
Quoted 1 line · Zixun LI
malloc()doesn't zero out memory, leavingep->ep.enableduninitiated.
... and that is a problem because ?
The _WHY_ part should be included in the commit message. Why is this change needed ? What does it fix ?