提交 b61b8af0 编写于 作者: R Rémi Denis-Courmont 提交者: David S. Miller

usb: gadget: f_phonet: fix memory allocation sizes

Signed-off-by: NRémi Denis-Courmont <remi.denis-courmont@nokia.com>
Signed-off-by: NFelipe Balbi <felipe.balbi@nokia.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 c69367fd
......@@ -569,9 +569,10 @@ static struct net_device *dev;
int __init phonet_bind_config(struct usb_configuration *c)
{
struct f_phonet *fp;
int err;
int err, size;
fp = kzalloc(sizeof(*fp), GFP_KERNEL);
size = sizeof(*fp) + (phonet_rxq_size * sizeof(struct usb_request *));
fp = kzalloc(size, GFP_KERNEL);
if (!fp)
return -ENOMEM;
......@@ -596,9 +597,7 @@ int __init gphonet_setup(struct usb_gadget *gadget)
/* Create net device */
BUG_ON(dev);
dev = alloc_netdev(sizeof(*port)
+ (phonet_rxq_size * sizeof(struct usb_request *)),
"upnlink%d", pn_net_setup);
dev = alloc_netdev(sizeof(*port), "upnlink%d", pn_net_setup);
if (!dev)
return -ENOMEM;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册