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/776b8ed3d14c
branches:  trunk
changeset: 827041:776b8ed3d14c
user:      maya <maya%NetBSD.org@localhost>
date:      Tue Oct 10 11:40:54 2017 +0000

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

diffstat:

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

diffs (32 lines):

diff -r bf8158484afa -r 776b8ed3d14c sys/dev/usb/usbdi_util.c
--- a/sys/dev/usb/usbdi_util.c  Tue Oct 10 09:29:14 2017 +0000
+++ b/sys/dev/usb/usbdi_util.c  Tue Oct 10 11:40:54 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: usbdi_util.c,v 1.66 2017/06/01 02:45:12 chs Exp $      */
+/*     $NetBSD: usbdi_util.c,v 1.67 2017/10/10 11:40:54 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.66 2017/06/01 02:45:12 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usbdi_util.c,v 1.67 2017/10/10 11:40:54 maya Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -335,10 +335,11 @@
 
        USBHIST_FUNC(); USBHIST_CALLED(usbdebug);
 
+       if (id == NULL)
+               return USBD_IOERROR;
        DPRINTFN(4, "iface=%p, report=%d, endpt=%d", iface, report,
             id->bInterfaceNumber, 0);
-       if (id == NULL)
-               return USBD_IOERROR;
+
        usbd_interface2device_handle(iface, &dev);
        req.bmRequestType = UT_WRITE_CLASS_INTERFACE;
        req.bRequest = UR_SET_PROTOCOL;



Home | Main Index | Thread Index | Old Index