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 try to deref a maybe-NULL pointer. instea...



details:   https://anonhg.NetBSD.org/src/rev/adcb3bfcef45
branches:  trunk
changeset: 453730:adcb3bfcef45
user:      mrg <mrg%NetBSD.org@localhost>
date:      Sat Aug 24 07:43:00 2019 +0000

description:
don't try to deref a maybe-NULL pointer.  instead of logging
potentially garbage (if not NULL), log the request length.

diffstat:

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

diffs (35 lines):

diff -r 4b7c344be754 -r adcb3bfcef45 sys/dev/usb/usbdi.c
--- a/sys/dev/usb/usbdi.c       Sat Aug 24 07:39:42 2019 +0000
+++ b/sys/dev/usb/usbdi.c       Sat Aug 24 07:43:00 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: usbdi.c,v 1.184 2019/08/22 07:38:06 mrg Exp $  */
+/*     $NetBSD: usbdi.c,v 1.185 2019/08/24 07:43:00 mrg Exp $  */
 
 /*
  * Copyright (c) 1998, 2012, 2015 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.184 2019/08/22 07:38:06 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.185 2019/08/24 07:43:00 mrg Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -1102,14 +1102,14 @@
 {
        struct usbd_xfer *xfer;
        usbd_status err;
+       size_t len = UGETW(req->wLength);
 
        USBHIST_FUNC();
        USBHIST_CALLARGS(usbdebug, "dev=%#jx req=%jx flgas=%jx len=%jx",
-           (uintptr_t)dev, (uintptr_t)req, flags, *actlen);
+           (uintptr_t)dev, (uintptr_t)req, flags, len);
 
        ASSERT_SLEEPABLE();
 
-       size_t len = UGETW(req->wLength);
        int error = usbd_create_xfer(dev->ud_pipe0, len, 0, 0, &xfer);
        if (error)
                return error;



Home | Main Index | Thread Index | Old Index