Module Name:    src
Committed By:   riastradh
Date:           Tue Jun 25 14:22:48 UTC 2024

Modified Files:
        src/sys/dev/pci: virtio_pci.c

Log Message:
virtio@pci: Zero sc_bars_iosize[i] on unmap.

No functional change intended, but this makes the code less brittle.

Prompted by PR kern/58335.


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 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.48 src/sys/dev/pci/virtio_pci.c:1.49
--- src/sys/dev/pci/virtio_pci.c:1.48	Tue Jun 25 14:22:30 2024
+++ src/sys/dev/pci/virtio_pci.c	Tue Jun 25 14:22:48 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: virtio_pci.c,v 1.48 2024/06/25 14:22:30 riastradh Exp $ */
+/* $NetBSD: virtio_pci.c,v 1.49 2024/06/25 14:22:48 riastradh 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.48 2024/06/25 14:22:30 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: virtio_pci.c,v 1.49 2024/06/25 14:22:48 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -556,7 +556,8 @@ err:
 		if (psc->sc_bars_iosize[i] == 0)
 			continue;
 		bus_space_unmap(psc->sc_bars_iot[i], psc->sc_bars_ioh[i],
-				psc->sc_bars_iosize[i]);
+		    psc->sc_bars_iosize[i]);
+		psc->sc_bars_iosize[i] = 0;
 	}
 	return ret;
 }

Reply via email to