Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/usb Reorder to test for null before null deref in de...



details:   https://anonhg.NetBSD.org/src/rev/82f2bb885966
branches:  trunk
changeset: 827042:82f2bb885966
user:      maya <maya%NetBSD.org@localhost>
date:      Tue Oct 10 11:43:26 2017 +0000

description:
Reorder to test for null before null deref in debug code

diffstat:

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

diffs (30 lines):

diff -r 776b8ed3d14c -r 82f2bb885966 sys/dev/usb/usbdi_util.c
--- a/sys/dev/usb/usbdi_util.c  Tue Oct 10 11:40:54 2017 +0000
+++ b/sys/dev/usb/usbdi_util.c  Tue Oct 10 11:43:26 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: usbdi_util.c,v 1.67 2017/10/10 11:40:54 maya Exp $     */
+/*     $NetBSD: usbdi_util.c,v 1.68 2017/10/10 11:43:26 maya Exp $     */
 
 /*
  * Copyright (c) 1998, 2012 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: usbdi_util.c,v 1.67 2017/10/10 11:40:54 maya Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usbdi_util.c,v 1.68 2017/10/10 11:43:26 maya Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -314,9 +314,10 @@
 
        USBHIST_FUNC(); USBHIST_CALLED(usbdebug);
 
-       DPRINTFN(4, "iface=%p, endpt=%d", iface, id->bInterfaceNumber, 0, 0);
        if (id == NULL)
                return USBD_IOERROR;
+       DPRINTFN(4, "iface=%p, endpt=%d", iface, id->bInterfaceNumber, 0, 0);
+
        usbd_interface2device_handle(iface, &dev);
        req.bmRequestType = UT_READ_CLASS_INTERFACE;
        req.bRequest = UR_GET_PROTOCOL;



Home | Main Index | Thread Index | Old Index