Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/x86/pci fix pci_intr_alloc(..., NULL, 0). reported ...
details: https://anonhg.NetBSD.org/src/rev/a4a8b281b032
branches: trunk
changeset: 809616:a4a8b281b032
user: knakahara <knakahara%NetBSD.org@localhost>
date: Fri Jul 24 06:49:58 2015 +0000
description:
fix pci_intr_alloc(..., NULL, 0). reported nonaka@n.o
diffstat:
sys/arch/x86/pci/pci_intr_machdep.c | 14 ++++++++------
1 files changed, 8 insertions(+), 6 deletions(-)
diffs (50 lines):
diff -r 6f66f06a32ed -r a4a8b281b032 sys/arch/x86/pci/pci_intr_machdep.c
--- a/sys/arch/x86/pci/pci_intr_machdep.c Fri Jul 24 06:17:10 2015 +0000
+++ b/sys/arch/x86/pci/pci_intr_machdep.c Fri Jul 24 06:49:58 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pci_intr_machdep.c,v 1.34 2015/07/21 03:10:42 knakahara Exp $ */
+/* $NetBSD: pci_intr_machdep.c,v 1.35 2015/07/24 06:49:58 knakahara Exp $ */
/*-
* Copyright (c) 1997, 1998, 2009 The NetBSD Foundation, Inc.
@@ -73,7 +73,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pci_intr_machdep.c,v 1.34 2015/07/21 03:10:42 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_intr_machdep.c,v 1.35 2015/07/24 06:49:58 knakahara Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -484,7 +484,8 @@
}
}
- memset(counts, 0, sizeof(counts[0]) * PCI_INTR_TYPE_SIZE);
+ if (counts != NULL)
+ memset(counts, 0, sizeof(counts[0]) * PCI_INTR_TYPE_SIZE);
error = EINVAL;
/* try MSI-X */
@@ -493,6 +494,8 @@
if (msix_count > 0) {
error = pci_msix_alloc_exact(pa, ihps, msix_count);
if (error == 0) {
+ KASSERTMSG(counts != NULL,
+ "If MSI-X is used, counts must not be NULL.");
counts[PCI_INTR_TYPE_MSIX] = msix_count;
goto out;
}
@@ -504,10 +507,9 @@
if (msi_count > 0) {
error = pci_msi_alloc_exact(pa, ihps, msi_count);
if (error == 0) {
- if (counts != NULL) {
+ if (counts != NULL)
counts[PCI_INTR_TYPE_MSI] = msi_count;
- goto out;
- }
+ goto out;
}
}
Home |
Main Index |
Thread Index |
Old Index