Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/pci Do not crash if subclassp == NULL, seen while at...



details:   https://anonhg.NetBSD.org/src/rev/68048ddbe12e
branches:  trunk
changeset: 329465:68048ddbe12e
user:      njoly <njoly%NetBSD.org@localhost>
date:      Sun May 25 14:56:46 2014 +0000

description:
Do not crash if subclassp == NULL, seen while attaching rstx(4) which
match PCI_CLASS_UNDEFINED class.

diffstat:

 sys/dev/pci/pci_subr.c |  7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diffs (28 lines):

diff -r 4c5ad2b1aaa5 -r 68048ddbe12e sys/dev/pci/pci_subr.c
--- a/sys/dev/pci/pci_subr.c    Sun May 25 14:56:23 2014 +0000
+++ b/sys/dev/pci/pci_subr.c    Sun May 25 14:56:46 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pci_subr.c,v 1.118 2014/05/24 18:06:21 msaitoh Exp $   */
+/*     $NetBSD: pci_subr.c,v 1.119 2014/05/25 14:56:46 njoly Exp $     */
 
 /*
  * Copyright (c) 1997 Zubin D. Dittia.  All rights reserved.
@@ -40,7 +40,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.118 2014/05/24 18:06:21 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.119 2014/05/25 14:56:46 njoly Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_pci.h"
@@ -637,7 +637,8 @@
                subclassp++;
        }
 
-       interfacep = (subclassp->name != NULL) ? subclassp->subclasses : NULL;
+       interfacep = (subclassp && subclassp->name != NULL) ?
+           subclassp->subclasses : NULL;
        while (interfacep && interfacep->name != NULL) {
                if (interface == interfacep->val)
                        break;



Home | Main Index | Thread Index | Old Index