summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorStefan Fritsch <sf@cvs.openbsd.org>2024-08-28 12:40:23 +0000
committerStefan Fritsch <sf@cvs.openbsd.org>2024-08-28 12:40:23 +0000
commitef6c62b11b6e5fdfc5a5bc9f16812aaf86c9dcc9 (patch)
tree352525664a08990ffb061b6cb205c3e1f3213490 /sys
parentb508a1011a989dc08339fe86f526ed3c99bd63e5 (diff)
vio: Fix allocation sizes
For both rx and tx, we need an array of bus_dmamap_t and mbuf pointers each. This results in a size of (rxqsize + txqsize) * (sizeof(bus_dmamap_t) + sizeof(struct mbuf *)) The factor 2 before the sizeof(bus_dmamap_t) was too much and we allocated more than we needed. OK bluhm@
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/pv/if_vio.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/dev/pv/if_vio.c b/sys/dev/pv/if_vio.c
index ffc98ff7969..470331d1d92 100644
--- a/sys/dev/pv/if_vio.c
+++ b/sys/dev/pv/if_vio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_vio.c,v 1.50 2024/08/27 19:11:20 sf Exp $ */
+/* $OpenBSD: if_vio.c,v 1.51 2024/08/28 12:40:22 sf Exp $ */
/*
* Copyright (c) 2012 Stefan Fritsch, Alexander Fiveg.
@@ -465,14 +465,14 @@ vio_alloc_mem(struct vio_softc *sc)
}
sc->sc_arrays = mallocarray(rxqsize + txqsize,
- 2 * sizeof(bus_dmamap_t) + sizeof(struct mbuf *), M_DEVBUF,
+ sizeof(bus_dmamap_t) + sizeof(struct mbuf *), M_DEVBUF,
M_WAITOK | M_CANFAIL | M_ZERO);
if (sc->sc_arrays == NULL) {
printf("unable to allocate mem for dmamaps\n");
goto err_hdr;
}
allocsize = (rxqsize + txqsize) *
- (2 * sizeof(bus_dmamap_t) + sizeof(struct mbuf *));
+ (sizeof(bus_dmamap_t) + sizeof(struct mbuf *));
sc->sc_tx_dmamaps = sc->sc_arrays + rxqsize;
sc->sc_rx_mbufs = (void*) (sc->sc_tx_dmamaps + txqsize);