summaryrefslogtreecommitdiff
path: root/usr.sbin/pcidump
diff options
context:
space:
mode:
authorjan <jan@cvs.openbsd.org>2021-03-05 20:06:40 +0000
committerjan <jan@cvs.openbsd.org>2021-03-05 20:06:40 +0000
commitf7a65ed1ec7bf932cdd19acac2d9e03e049756b7 (patch)
tree61c06a280ae7998c7a3371abcc20e915430e5610 /usr.sbin/pcidump
parent08b34b4a6cf594a0a4024d6d545b43731503059c (diff)
Avoid print for NULL pointer
The subclass arrays have to be empty. OK deraadt@
Diffstat (limited to 'usr.sbin/pcidump')
-rw-r--r--usr.sbin/pcidump/pcidump.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/usr.sbin/pcidump/pcidump.c b/usr.sbin/pcidump/pcidump.c
index 97c9ad1f2c3..bc98460cda6 100644
--- a/usr.sbin/pcidump/pcidump.c
+++ b/usr.sbin/pcidump/pcidump.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pcidump.c,v 1.62 2021/03/05 12:57:20 jan Exp $ */
+/* $OpenBSD: pcidump.c,v 1.63 2021/03/05 20:06:39 jan Exp $ */
/*
* Copyright (c) 2006, 2007 David Gwynne <loki@animata.net>
@@ -1296,8 +1296,8 @@ static const struct pci_subclass pci_subclass_dasp[] = {
{ PCI_SUBCLASS_DASP_MISC, "Miscellaneous" },
};
-static const struct pci_subclass pci_subclass_accelerator[] = {0};
-static const struct pci_subclass pci_subclass_instrumentation[] = {0};
+static const struct pci_subclass pci_subclass_accelerator[] = {};
+static const struct pci_subclass pci_subclass_instrumentation[] = {};
#define CLASS(_c, _n, _s) { \
.class = _c, \
@@ -1389,7 +1389,6 @@ pci_class_name(pci_class_t class)
return (pc->name);
}
-
static const char *
pci_subclass_name(pci_class_t class, pci_subclass_t subclass)
{
@@ -1401,7 +1400,7 @@ pci_subclass_name(pci_class_t class, pci_subclass_t subclass)
return ("(unknown)");
ps = pci_subclass(pc, subclass);
- if (ps == NULL)
+ if (ps == NULL || ps->name == NULL)
return ("(unknown)");
return (ps->name);