Module Name: src Committed By: maya Date: Tue Oct 10 11:40:54 UTC 2017
Modified Files: src/sys/dev/usb: usbdi_util.c Log Message: Reorder to test for null before null deref in debug code To generate a diff of this commit: cvs rdiff -u -r1.66 -r1.67 src/sys/dev/usb/usbdi_util.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/usb/usbdi_util.c diff -u src/sys/dev/usb/usbdi_util.c:1.66 src/sys/dev/usb/usbdi_util.c:1.67 --- src/sys/dev/usb/usbdi_util.c:1.66 Thu Jun 1 02:45:12 2017 +++ src/sys/dev/usb/usbdi_util.c Tue Oct 10 11:40:54 2017 @@ -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 @@ usbd_set_protocol(struct usbd_interface USBHIST_FUNC(); USBHIST_CALLED(usbdebug); - DPRINTFN(4, "iface=%p, report=%d, endpt=%d", iface, report, - id->bInterfaceNumber, 0); if (id == NULL) return USBD_IOERROR; + DPRINTFN(4, "iface=%p, report=%d, endpt=%d", iface, report, + id->bInterfaceNumber, 0); + usbd_interface2device_handle(iface, &dev); req.bmRequestType = UT_WRITE_CLASS_INTERFACE; req.bRequest = UR_SET_PROTOCOL;