Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/pci Although the header structure can be smaller, th...



details:   https://anonhg.NetBSD.org/src/rev/839e932f3a96
branches:  trunk
changeset: 980321:839e932f3a96
user:      reinoud <reinoud%NetBSD.org@localhost>
date:      Sun Jan 31 14:17:48 2021 +0000

description:
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.

diffstat:

 sys/dev/pci/if_vioif.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (30 lines):

diff -r 79b32b28d545 -r 839e932f3a96 sys/dev/pci/if_vioif.c
--- a/sys/dev/pci/if_vioif.c    Sun Jan 31 14:05:00 2021 +0000
+++ b/sys/dev/pci/if_vioif.c    Sun Jan 31 14:17:48 2021 +0000
@@ -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 @@
                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,



Home | Main Index | Thread Index | Old Index