Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/usb uvideo(4): Convert conditional to KASSERT in uvi...



details:   https://anonhg.NetBSD.org/src/rev/91beb7bcd248
branches:  trunk
changeset: 365286:91beb7bcd248
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sun Apr 17 13:17:19 2022 +0000

description:
uvideo(4): Convert conditional to KASSERT in uvideo_attach.

usb_desc_iter_next_interface no longer returns truncated interface
descriptors, so we no longer have to check for that here.

diffstat:

 sys/dev/usb/uvideo.c |  11 +++--------
 1 files changed, 3 insertions(+), 8 deletions(-)

diffs (32 lines):

diff -r b7752f7679e6 -r 91beb7bcd248 sys/dev/usb/uvideo.c
--- a/sys/dev/usb/uvideo.c      Sun Apr 17 13:17:06 2022 +0000
+++ b/sys/dev/usb/uvideo.c      Sun Apr 17 13:17:19 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvideo.c,v 1.76 2022/04/17 13:17:06 riastradh Exp $    */
+/*     $NetBSD: uvideo.c,v 1.77 2022/04/17 13:17:19 riastradh Exp $    */
 
 /*
  * Copyright (c) 2008 Patrick Mahoney
@@ -42,7 +42,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvideo.c,v 1.76 2022/04/17 13:17:06 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvideo.c,v 1.77 2022/04/17 13:17:19 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -530,12 +530,7 @@
        /* iterate through interface descriptors and initialize softc */
        usb_desc_iter_init(sc->sc_udev, &iter);
        while ((ifdesc = usb_desc_iter_next_interface(&iter)) != NULL) {
-               if (ifdesc->bLength < USB_INTERFACE_DESCRIPTOR_SIZE) {
-                       DPRINTFN(50, ("uvideo_attach: "
-                                     "ignoring incorrect descriptor len=%d\n",
-                                     ifdesc->bLength));
-                       continue;
-               }
+               KASSERT(ifdesc->bLength >= USB_INTERFACE_DESCRIPTOR_SIZE);
                if (ifdesc->bInterfaceClass != UICLASS_VIDEO) {
                        DPRINTFN(50, ("uvideo_attach: "
                                      "ignoring non-uvc interface: "



Home | Main Index | Thread Index | Old Index