This issue was reported by coccicheck using the semantic patch
at scripts/coccinelle/api/memdup.cocci
Signed-off-by: Benoit Taine <benoit.taine@lip6.fr>
Signed-off-by: Felipe Balbi <balbi@ti.com>
if (page[len - 1] == '\n' || page[len - 1] == '\0')
--len;
- new_data = kzalloc(len, GFP_KERNEL);
+ new_data = kmemdup(page, len, GFP_KERNEL);
if (!new_data)
return -ENOMEM;
- memcpy(new_data, page, len);
-
if (desc->opts_mutex)
mutex_lock(desc->opts_mutex);
kfree(ext_prop->data);
dma_addr_t dma_handle;
struct device_node *isp1301_node;
- udc = kzalloc(sizeof(*udc), GFP_KERNEL);
+ udc = kmemdup(&controller_template, sizeof(*udc), GFP_KERNEL);
if (!udc)
return -ENOMEM;
- memcpy(udc, &controller_template, sizeof(*udc));
for (i = 0; i <= 15; i++)
udc->ep[i].udc = udc;
udc->gadget.ep0 = &udc->ep[0].ep;