Module Name: src Committed By: reinoud Date: Sun Jan 31 14:17:48 UTC 2021
Modified Files: src/sys/dev/pci: if_vioif.c Log Message: Although the header structure can be smaller, the headers *are* indexed as if they are full sized so allocate enough memory so the indexing works as expected and we are not scribbling outside bounds. To generate a diff of this commit: cvs rdiff -u -r1.66 -r1.67 src/sys/dev/pci/if_vioif.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/pci/if_vioif.c diff -u src/sys/dev/pci/if_vioif.c:1.66 src/sys/dev/pci/if_vioif.c:1.67 --- src/sys/dev/pci/if_vioif.c:1.66 Wed Jan 20 19:46:48 2021 +++ src/sys/dev/pci/if_vioif.c Sun Jan 31 14:17:48 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: if_vioif.c,v 1.66 2021/01/20 19:46:48 reinoud Exp $ */ +/* $NetBSD: if_vioif.c,v 1.67 2021/01/31 14:17:48 reinoud Exp $ */ /* * Copyright (c) 2020 The NetBSD Foundation, Inc. @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_vioif.c,v 1.66 2021/01/20 19:46:48 reinoud Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_vioif.c,v 1.67 2021/01/31 14:17:48 reinoud Exp $"); #ifdef _KERNEL_OPT #include "opt_net_mpsafe.h" @@ -611,9 +611,9 @@ vioif_alloc_mems(struct vioif_softc *sc) txq = &sc->sc_txq[qid]; rxq->rxq_hdrs = vioif_assign_mem(&p, - sc->sc_hdr_size * rxq->rxq_vq->vq_num); + sizeof(struct virtio_net_hdr) * rxq->rxq_vq->vq_num); txq->txq_hdrs = vioif_assign_mem(&p, - sc->sc_hdr_size * txq->txq_vq->vq_num); + sizeof(struct virtio_net_hdr) * txq->txq_vq->vq_num); } if (sc->sc_has_ctrl) { ctrlq->ctrlq_cmd = vioif_assign_mem(&p,