[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1479133391.8455.52.camel@edumazet-glaptop3.roam.corp.google.com>
Date: Mon, 14 Nov 2016 06:23:11 -0800
From: Eric Dumazet <eric.dumazet@...il.com>
To: Phil Sutter <phil@....cc>
Cc: David Miller <davem@...emloft.net>, netdev@...r.kernel.org,
Sabrina Dubroca <sd@...asysnail.net>
Subject: Re: [net-next PATCH v2] net: dummy: Introduce dummy virtual
functions
On Mon, 2016-11-14 at 14:02 +0100, Phil Sutter wrote:
> The idea for this was born when testing VF support in iproute2 which was
> impeded by hardware requirements. In fact, not every VF-capable hardware
> driver implements all netdev ops, so testing the interface is still hard
> to do even with a well-sorted hardware shelf.
>
...
> static int dummy_dev_init(struct net_device *dev)
> {
> + struct dummy_priv *priv = netdev_priv(dev);
> +
> dev->dstats = netdev_alloc_pcpu_stats(struct pcpu_dstats);
> if (!dev->dstats)
> return -ENOMEM;
>
> + priv->num_vfs = num_vfs;
> + priv->vfinfo = NULL;
> +
> + if (!num_vfs)
> + return 0;
> +
> + priv->vfinfo = kcalloc(num_vfs, sizeof(struct vf_data_storage),
> + GFP_KERNEL);
> + if (!priv->vfinfo)
> + return -ENOMEM;
You must free dev->dstats here, otherwise kernel memory will leak.
> +
> return 0;
> }
>
Powered by blists - more mailing lists