Module Name: src Committed By: reinoud Date: Sun Jan 24 14:12:36 UTC 2021
Modified Files: src/sys/dev/pci: virtio_pci.c Log Message: Prevent potential buffer over runs in number of BARS To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 src/sys/dev/pci/virtio_pci.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/virtio_pci.c diff -u src/sys/dev/pci/virtio_pci.c:1.20 src/sys/dev/pci/virtio_pci.c:1.21 --- src/sys/dev/pci/virtio_pci.c:1.20 Sun Jan 24 01:44:11 2021 +++ src/sys/dev/pci/virtio_pci.c Sun Jan 24 14:12:36 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: virtio_pci.c,v 1.20 2021/01/24 01:44:11 christos Exp $ */ +/* $NetBSD: virtio_pci.c,v 1.21 2021/01/24 14:12:36 reinoud Exp $ */ /* * Copyright (c) 2020 The NetBSD Foundation, Inc. @@ -28,7 +28,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: virtio_pci.c,v 1.20 2021/01/24 01:44:11 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: virtio_pci.c,v 1.21 2021/01/24 14:12:36 reinoud Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -65,9 +65,9 @@ struct virtio_pci_softc { bus_size_t sc_mapped_iosize; /* BARs */ - bus_space_tag_t sc_bars_iot[4]; - bus_space_handle_t sc_bars_ioh[4]; - bus_size_t sc_bars_iosize[4]; + bus_space_tag_t sc_bars_iot[NMAPREG]; + bus_space_handle_t sc_bars_ioh[NMAPREG]; + bus_size_t sc_bars_iosize[NMAPREG]; /* notify space */ bus_space_tag_t sc_notify_iot;