sparc64: vnet: add size to free(9) call

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

sparc64: vnet: add size to free(9) call

Klemens Nanni-2
Without any later realloactions, size is taken from vnet_dring_alloc():

        struct vnet_dring *vd;
        vd = malloc(sizeof(struct vnet_dring), M_DEVBUF, M_NOWAIT);

Tested on T4-2 guest domains:

        vnet0 at cbus0 chan 0x6: ivec 0xc, 0xd, address 00:14:4f:f9:3f:34
        vnet1 at cbus0 chan 0x7: ivec 0xe, 0xf, address 00:14:4f:fb:05:2d

Feedback? OK?

diff --git a/sys/arch/sparc64/dev/vnet.c b/sys/arch/sparc64/dev/vnet.c
index 147caf1f2..97883df76 100644
--- a/sys/arch/sparc64/dev/vnet.c
+++ b/sys/arch/sparc64/dev/vnet.c
@@ -1535,5 +1535,5 @@ vnet_dring_free(bus_dma_tag_t t, struct vnet_dring *vd)
  bus_dmamem_unmap(t, (caddr_t)vd->vd_desc, size);
  bus_dmamem_free(t, &vd->vd_seg, 1);
  bus_dmamap_destroy(t, vd->vd_map);
- free(vd, M_DEVBUF, 0);
+ free(vd, M_DEVBUF, sizeof(*vd));