From: jan Date: Fri, 5 Mar 2021 20:06:39 +0000 (+0000) Subject: Avoid print for NULL pointer X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=8c95b155acbb590bea134a94f0410e496bc3e646;p=openbsd Avoid print for NULL pointer The subclass arrays have to be empty. OK deraadt@ --- 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 @@ -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);