Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/usb Don't dereference NULL pointer when no device at...



details:   https://anonhg.NetBSD.org/src/rev/b607a9e10966
branches:  trunk
changeset: 521289:b607a9e10966
user:      augustss <augustss%NetBSD.org@localhost>
date:      Sun Jan 27 18:10:34 2002 +0000

description:
Don't dereference NULL pointer when no device attaches.

diffstat:

 sys/dev/usb/uhidev.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (31 lines):

diff -r 0f4b7467b0c1 -r b607a9e10966 sys/dev/usb/uhidev.c
--- a/sys/dev/usb/uhidev.c      Sun Jan 27 15:31:57 2002 +0000
+++ b/sys/dev/usb/uhidev.c      Sun Jan 27 18:10:34 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uhidev.c,v 1.3 2001/12/29 20:50:16 augustss Exp $      */
+/*     $NetBSD: uhidev.c,v 1.4 2002/01/27 18:10:34 augustss Exp $      */
 
 /*
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -224,9 +224,9 @@
                        dev = (struct uhidev *)config_found_sm(self, &uha,
                                                   uhidevprint, uhidevsubmatch);
                        sc->sc_subdevs[repid] = dev;
-                       dev->sc_in_rep_size = repsizes[repid];
+                       if (dev != NULL) {
+                               dev->sc_in_rep_size = repsizes[repid];
 #ifdef DIAGNOSTIC
-                       if (dev != NULL) {
                                DPRINTF(("uhidev_match: repid=%d dev=%p\n",
                                         repid, dev));
                                if (dev->sc_intr == NULL) {
@@ -234,8 +234,8 @@
                                               USBDEVNAME(sc->sc_dev));
                                        USB_ATTACH_ERROR_RETURN;
                                }
+#endif
                        }
-#endif
                }
        }
 



Home | Main Index | Thread Index | Old Index