Without any later realloactions, size is taken from vdsk_dring_alloc():

        struct vdisk_dring *vd;
        ...
        vd = malloc(sizeof(struct vdsk_dring), M_DEVBUF, M_NOWAIT);

Tested on T4-2 guest domains, altough that of course just means that
allocating rings keeps working as before and the free routines are not
actually called:

        vdsk0 at cbus0 chan 0x2: ivec 0x4, 0x5
        scsibus1 at vdsk0: 1 targets
        vdsk1 at cbus0 chan 0x3: ivec 0x6, 0x7
        scsibus2 at vdsk1: 1 targets
        vdsk2 at cbus0 chan 0x4: ivec 0x8, 0x9
        scsibus3 at vdsk2: 1 targets
        vdsk3 at cbus0 chan 0x5: ivec 0xa, 0xb
        scsibus4 at vdsk3: 1 targets

Feedback? OK?

diff --git a/sys/arch/sparc64/dev/vdsk.c b/sys/arch/sparc64/dev/vdsk.c
index 169bd8399..358e6b40e 100644
--- a/sys/arch/sparc64/dev/vdsk.c
+++ b/sys/arch/sparc64/dev/vdsk.c
@@ -883,7 +883,7 @@ vdsk_dring_free(bus_dma_tag_t t, struct vdsk_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));
 }
 
 void *

Reply via email to