Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b61b8af0 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont Committed by David S. Miller
Browse files

usb: gadget: f_phonet: fix memory allocation sizes

parent c69367fd
Loading
Loading
Loading
Loading
+4 −5
Original line number Original line Diff line number Diff line
@@ -569,9 +569,10 @@ static struct net_device *dev;
int __init phonet_bind_config(struct usb_configuration *c)
int __init phonet_bind_config(struct usb_configuration *c)
{
{
	struct f_phonet *fp;
	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)
	if (!fp)
		return -ENOMEM;
		return -ENOMEM;


@@ -596,9 +597,7 @@ int __init gphonet_setup(struct usb_gadget *gadget)


	/* Create net device */
	/* Create net device */
	BUG_ON(dev);
	BUG_ON(dev);
	dev = alloc_netdev(sizeof(*port)
	dev = alloc_netdev(sizeof(*port), "upnlink%d", pn_net_setup);
		+ (phonet_rxq_size * sizeof(struct usb_request *)),
				"upnlink%d", pn_net_setup);
	if (!dev)
	if (!dev)
		return -ENOMEM;
		return -ENOMEM;